In one script i have seen - in #! line can somebody explain the meaning of -(hyphen) here
#! /bin/sh -
In one script i have seen - in #! line can somebody explain the meaning of -(hyphen) here
#! /bin/sh -
I don't think it serves any useful purpose.
At first view and some experimenting i think you are right but i would request somebody who knows the answer pls explain.
ok, my explanation...
well, looking through man sh there is no hyphen command line.
as we all know if $0 begins with a '-' then it is a login script,
but this is not the case. Often a lone - (e.g cat - )
means take stdin, well a #! line takes stdin as the file anyway
so I think myself it's a redundant use of this meaning.
p.s. I have no work today
echo 'ls' | sh -
does exactly what you expect, sh reads from stdin. I think it's an artifact from very antique systems. Chris F A Johnson posts here and will know definitely.
Thank you all for the interest.What i found is this is something related with the security and prevent some kind of spoofing attacks(mainly with sid).
The text posted below is from the link posted by Perderabo.
But still i am not able to understand what is it.I would appreciate if somebody can explain it in simple language.