Why is a tilde in a path not expanded in a shell script?

In the bash manual, note that brace expansion during parameter substitution, but not recursively: The order of expansions is: brace expansion; tilde expansion, parameter and variable expansion, arithmetic expansion, and command substitution (done in a left-to-right fashion); word splitting; and filename expansion. This implies that any tilde (or parameter references or command substitution) stored unexpanded … Read more

Bash script: bad interpreter

The first line, #!/bin/bash, tells Linux where to find the interpreter. The script should also be executable with chmod +x script.sh, which it appears you did. It is highly likely that you created this file with a windows editor, which will place a <cr><lf> at the end of each line. This is the standard under … Read more