In the comments to the accepted answer to this Unix & Linux StackExchange question, it is stated that
$_ is “one of only some 7 special parameters defined by POSIX”. I can’t find that definition although I can find eight other special parameters defined by POSIX and I’ve seen
$_ defined in the ksh and bash man pages. Can someone point me to the definition in POSIX?
Here is Solutions:
We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.
The only reference I can find to the special parameter
$_ in POSIX is in the rationale section on Shell Variables. This excerpt implies that it was used by a variety of shells, but not in a standard way by all and was omitted intentionally:
(Underscore.) While underscore is historical practice, its overloaded usage in the
KornShell is confusing, and it has been omitted from the Shell and Utilities volume
of IEEE Std 1003.1-2001.
So it may be used by most or all POSIX-conforming shells, but it is decidedly not defined by POSIX.
Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂