putting output of command into a string

by golfballs   Last Updated May 16, 2019 01:02 AM

I want to store the output of a bash command to a string in a bash script. The part that matters is as follows:

#!/bin/bash
player_status="$(playerctl -l)"

The output of the command when run on terminal (not with the bash script) is "No players were found". When I run the bash script (note that there is not an echo) it outputs "No players were found" to the terminal. I want it instead to not put it in the terminal but instead the variable.



Related Questions


Updated October 17, 2017 15:02 PM

Updated June 29, 2015 16:01 PM

Updated April 05, 2015 18:00 PM

Updated April 16, 2015 21:00 PM

Updated April 20, 2015 22:00 PM