UnitTesting
UnitTesting copied to clipboard
Do not use sh on travis because sh and bash are very different
May be this is what is helping https://github.com/SublimeText/UnitTesting/issues/159 (travis.sh and run_tests.py reported success when it a was failure) to exists?
https://github.com/SublimeText/UnitTesting/blob/d94dcb0dd1e209490acf1657c716becb71f5006c/.travis.yml#L33-L35
On the headers of the files, it is already defined to use #!/bin/bash, but if you directly launches it with sh travis.sh sh will be used instead of bash.
- https://askubuntu.com/questions/172481/is-bash-scripting-the-same-as-shell-scripting
AFAIK, the header is only used when the file is an executable. I don't think it is the cause of #159.
I just tested adding #!/bin/bash to all shell scripts, but the script install_sublime_text.sh crashed on Mac OS.
Currently install_sublime_text.sh has this #! /usr/bin/env bash which does nothing because it has a space after the #!. My guess, someone else was seeing this crash on Mac OS and "disabled" shell bang putting that space.
I tested it putting directly #!/bin/sh which should be the default on Mac OS and not crash happened.
#! /usr/bin/env bash should just work
(penguin)-~$ cat ./foo.sh
#! /usr/bin/env bash
if [[ true ]]; then
echo TRUE
else
echo FALSE
fi
(penguin)-~$ sh ./foo.sh
./foo.sh: 3: ./foo.sh: [[: not found
FALSE
(penguin)-~$ bash ./foo.sh
TRUE
(penguin)-~$ chmod +x ./foo.sh
(penguin)-~$ ./foo.sh
TRUE
(penguin)-~$ sh -c './foo.sh'
TRUE
The script only works in bash, and not sh (of linux) because [[ is not necessarily supported.