Skip to main content
2 of 3
[POSIXified](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html)
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k

You could try

ps -o comm= -p "$$"

which will give you the name of the command associated with the script's pid.

Flup
  • 8.3k
  • 2
  • 37
  • 51