Despite the unlikely problem of OP, a fairly similar error message - it brought me here - may appear if your shebang is of a character. In my case, the script is still running, but the error is very annoying - especially since I help someone with their "official" procedure, and errors in such cases are undesirable.
Output Example:
CS-015:
As a result, the cat shows how:
$ cat check.sh #!/bin/ksh THIS_SCRIPT="$(basename $0)" echo "$THIS_SCRIPT" exit 0 # Nothing else matters; I had narrowed it to here...
In this case, I inherited the file, and hexdump shows:
$ hexdump -C check.sh 00000000 ef bb bf 23 21 20 2f 62 69 6e 2f 6b 73 68 0a 0a |...#! /bin/ksh..| 00000010 54 48 49 53 5f 53 43 52 49 50 54 3d 22 24 28 62 |THIS_SCRIPT="$(b| ...
As Stefan Shazelas suggests at https://unix.stackexchange.com/a/381263/17300 , you can remove this with sed:
$ sed -i '1s/^\xEF\xBB\xBF//' check.sh
sage
source share