I have this script (among others) that generates my wallpaper upon every login/midnight. It 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 == *\'* ]]
then
# <...1...>
else
# <...2...>
fi
I'm interested if my $TIME
variable has '
symbols in it. When there are no '
symbols - everything is good.
Now when I know there is at least one '
symbol (or I can force make that way), when I double-click the script I find myself in else
statement, when I run the script in terminal - I find myself in then
statement. I would like to always get to then
statement, but how?
I cropped the part that is failing (left - correct, right - wrong):
It took me to write a post until I notice that shebang is not actually a shebang. #!/bin/bash
fixed the problem.
It appears that incorrect shebang defaulted to /bin/sh
which was incapable of running correctly. My login shell is /bin/bash
which means running from shell even without bash
keyword eg.: ./script.sh
defaults to bash and not sh. Why couldn't it do the same on double-click..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With