Reputation: 184
I have inherited a number of shell scripts on a Centos system which start with #:
on the first line.
$ ./test.sh
This is an example of one of the working scripts:#:
DATE=`date +%D::%H:%M`
LOG=/home/alert/bin/log/test.log
echo ${DATE} >> ${LOG}
exit
What does #: mean?
I know what a 'normal' shebang means such as #!/bin/sh
I have looked all over the internet and stack overflow and haven't found an answer. I'm guessing it means "use your shell"? (ie., #!$SHELL)?
FYI - There is one other question/answer regarding #: imbedded in shell scripts where #: is a type of comment that is included in man files. In this instance, it does not appear to apply given that this comment only appears on the first line of the file and does not have any following text.
Upvotes: 2
Views: 586
Reputation: 95242
Good question. It is not treated as a shebang; the script appears to run the same way any other script with no shebang is run by the shell: it shows up in ps
as bash -himBH
rather than bash filename
. As far as I can tell, it's just a comment.
It might be the old "hey, this is a shell script!" syntax from before interpreter support via #!
was added to the exec
system call: scripts that started with #:
- actually, probably just #
or :
would work - would be recognized as such by the shell itself and executed by it directly rather than by calling exec
. I can't think of a reason for it on a modern system, though.
Upvotes: 4