Skip to main content
oops, wrong translation
Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k

You could try

ps -o comm=args= -p "$$"

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

You could try

ps -o comm= -p "$$"

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

You could try

ps -o args= -p "$$"

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

[POSIXified](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ps.html)
Source Link
Stéphane Chazelas
  • 584.7k
  • 96
  • 1.1k
  • 1.7k

You could try


ps --no-headers -o cmd -p $$
ps -o comm= -p "$$"

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

You could try


ps --no-headers -o cmd -p $$

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

You could try

ps -o comm= -p "$$"

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

Source Link
Flup
  • 8.3k
  • 2
  • 37
  • 51

You could try

ps --no-headers -o cmd -p $$

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