linux - Using commands in Bash Script Variables -
i have bash script checks current status of dropbox
#!/bin/bash while true echo dropbox status: ~/bin/dropbox.py status sleep 1 clear done this produces output can this.
dropbox status: date however this. on 1 line
dropbox status: update i have tried scripts such as
#!/bin/bash while true status=~/bin/dropbox.py status echo dropbox status: $status sleep 1 clear done however creates errors such dropbox status.sh: status: not found
is there way after?
also if blatantly obvious apologize since new bash script
thanks help.
use printf , command substitution:
printf "dropbox status: %s\n" "$(~/bin/dropbox.py status)" or intermediate variable:
status=$(~/bin/dropbox.py status) printf "dropbox status: %s\n" "$status" also remember quote variables or undergo word splitting
why doesn't status=~/bin/dropbox.py status work? whats happens command status called environment variable status set ~/bin/dropbox.py, sort of same running:
_status=$status export status=~/bin/dropbox.py status export status=_status but without temporary variables
Comments
Post a Comment