Bash script different output when doubleclick vs. run in terminal -
i have script (among others) generates wallpaper upon every login/midnight. has 755 permissions. part of code:
#/bin/bash convert -size 1440x900 xc:none wall.png composite -gravity center ../pics/im256.png wall.png wall.png composite -geometry 118x67+661+578 ../pics/im-title-white.png wall.png wall.png time=`$home/bin/time.py | grep "\."` if [[ $time == *\'* ]] # <...1...> else # <...2...> fi
i'm interested if $time
variable has '
symbols in it. when there no '
symbols - good.
now when know there @ least 1 '
symbol (or can force make way), when double-click script find myself in else
statement, when run script in terminal - find myself in then
statement. then
statement, how?
i cropped part failing (left - correct, right - wrong):
it took me write post until notice shebang not shebang. #!/bin/bash
fixed problem.
it appears incorrect shebang defaulted /bin/sh
incapable of running correctly. login shell /bin/bash
means running shell without bash
keyword eg.: ./script.sh
defaults bash , not sh. why couldn't same on double-click..
Comments
Post a Comment