Skip to main content
added 6 characters in body
Source Link
jesse_b
  • 41.6k
  • 14
  • 108
  • 162

Adding to Gilles answer, you MAY be able to get the shell script (if $0 = ashif $0 = ash) through the /proc/$$ interface/proc/$$ interface. I don't know how accurate this is, but /proc/$$/fd/11/proc/$$/fd/11 seems to always point to this_script with BusyBox's ash.

Providing this as a potential answer to those who come across this page (as did I).

Last answer was deleted -- so, my claim to this working is tested on 4 different HW platforms (x86, ARM, XLP, and powerpc). All give the same answer of fd/11. A readlink from /proc/$$/fd/11/proc/$$/fd/11 yields my script.

Andy

Adding to Gilles answer, you MAY be able to get the shell script (if $0 = ash) through the /proc/$$ interface. I don't know how accurate this is, but /proc/$$/fd/11 seems to always point to this_script with BusyBox's ash.

Providing this as a potential answer to those who come across this page (as did I).

Last answer was deleted -- so, my claim to this working is tested on 4 different HW platforms (x86, ARM, XLP, and powerpc). All give the same answer of fd/11. A readlink from /proc/$$/fd/11 yields my script.

Andy

Adding to Gilles answer, you MAY be able to get the shell script (if $0 = ash) through the /proc/$$ interface. I don't know how accurate this is, but /proc/$$/fd/11 seems to always point to this_script with BusyBox's ash.

Providing this as a potential answer to those who come across this page (as did I).

Last answer was deleted -- so, my claim to this working is tested on 4 different HW platforms (x86, ARM, XLP, and powerpc). All give the same answer of fd/11. A readlink from /proc/$$/fd/11 yields my script.

Andy

Source Link

Adding to Gilles answer, you MAY be able to get the shell script (if $0 = ash) through the /proc/$$ interface. I don't know how accurate this is, but /proc/$$/fd/11 seems to always point to this_script with BusyBox's ash.

Providing this as a potential answer to those who come across this page (as did I).

Last answer was deleted -- so, my claim to this working is tested on 4 different HW platforms (x86, ARM, XLP, and powerpc). All give the same answer of fd/11. A readlink from /proc/$$/fd/11 yields my script.

Andy