BASH - Getting an rsh command to return a value or to timeout

750 views Asked by At

I am trying to set a variable in a Bash script to the results of running a command on a remote machine via rsh with a timeout option, such as...

timeout -s KILL 2 rsh jane df -h | grep StorageMedia
                  2.7T  2.1T  607G  78% /mnt/StorageMedia

I have tried the following...

rshresult="$(timeout -s KILL 3 rsh remotemachine df -h | grep StorageMedia)"

and

rshresult=`timeout -s KILL 3 rsh remotemachine df -h | grep StorageMedia`

...but both timeout after 3 seconds without setting $rshresult.

Running

0

There are 0 answers