Skip to main content
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

From bash manual

_

At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. Subsequently, expands to the last argument to the previous command, after expansion. Also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file.

Regarding the sentence in bold, Stephane said thatStephane said that

bash, like a few other shells will pass a _ environment variable to commands it executes that contains the path that bash used as the first argument to the execve() system calls.

$ env | grep '^_'
_=/usr/bin/env

How can I get the environment variable _'s value for an arbitrary command instead of env, to verify that its value is the pathname of the executable or script for the command?

Thanks.

From bash manual

_

At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. Subsequently, expands to the last argument to the previous command, after expansion. Also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file.

Regarding the sentence in bold, Stephane said that

bash, like a few other shells will pass a _ environment variable to commands it executes that contains the path that bash used as the first argument to the execve() system calls.

$ env | grep '^_'
_=/usr/bin/env

How can I get the environment variable _'s value for an arbitrary command instead of env, to verify that its value is the pathname of the executable or script for the command?

Thanks.

From bash manual

_

At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. Subsequently, expands to the last argument to the previous command, after expansion. Also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file.

Regarding the sentence in bold, Stephane said that

bash, like a few other shells will pass a _ environment variable to commands it executes that contains the path that bash used as the first argument to the execve() system calls.

$ env | grep '^_'
_=/usr/bin/env

How can I get the environment variable _'s value for an arbitrary command instead of env, to verify that its value is the pathname of the executable or script for the command?

Thanks.

edited tags
Link
Gilles 'SO- stop being evil'
  • 865.3k
  • 205
  • 1.8k
  • 2.3k
added 60 characters in body
Source Link
Tim
  • 106.8k
  • 234
  • 650
  • 1.1k

From bash manual

_

At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. Subsequently, expands to the last argument to the previous command, after expansion. Also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file.

Regarding the sentence in bold, Stephane said thatStephane said that

bash, like a few other shells will pass a _ environment variable to commands it executes that contains the path that bash used as the first argument to the execve() system calls.

$ env | grep '^_'
_=/usr/bin/env

How can I get the environment variable _'s value for an arbitrary command instead of env, to verify that its value is the pathname of the executable or script for the command?

Thanks.

From bash manual

_

At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. Subsequently, expands to the last argument to the previous command, after expansion. Also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file.

Regarding the sentence in bold, Stephane said that

bash, like a few other shells will pass a _ environment variable to commands it executes that contains the path that bash used as the first argument to the execve() system calls.

$ env | grep '^_'
_=/usr/bin/env

How can I get the environment variable _'s value for an arbitrary command instead of env, to verify that its value is the pathname of the executable or script for the command?

Thanks.

From bash manual

_

At shell startup, set to the absolute pathname used to invoke the shell or shell script being executed as passed in the environment or argument list. Subsequently, expands to the last argument to the previous command, after expansion. Also set to the full pathname used to invoke each command executed and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file.

Regarding the sentence in bold, Stephane said that

bash, like a few other shells will pass a _ environment variable to commands it executes that contains the path that bash used as the first argument to the execve() system calls.

$ env | grep '^_'
_=/usr/bin/env

How can I get the environment variable _'s value for an arbitrary command instead of env, to verify that its value is the pathname of the executable or script for the command?

Thanks.

Source Link
Tim
  • 106.8k
  • 234
  • 650
  • 1.1k
Loading