Storing output of Ubuntu 22.04 shutdown command into variable

Viewed 50

I am learning bash and am trying to make an application for a shutdown timer using Zenity. As a feedback I want to display the output of the standard shutdown command.

In console, the command:

shutdown -h 30

gives me the output:

Shutdown scheduled for Sun 2022-09-18 13:58:36 CEST, use 'shutdown -c' to cancel.

Now I want to store the output into a variable. I tried:

FEEDBACK=$(shutdown -h +30) 

but then

echo $FEEDBACK

is empty.

0 Answers
Related