2

I have something like this

./myProcess.sh &

So I run it in background. When I put ps the proccess name is "bash".

16282 pts/5    00:00:00 bash

Is there any way of starting a process with a name? When I put the command ps, I wanna see the proccess name (and the PID, and other information), not "bash".

Thank you so much

F . Brasburg
  • 23
  • 1
  • 4
  • 2
    As an aside, using a `.sh` extension for executable shell scripts (as opposed to shell libraries intended to be sourced rather than executed) is bad form: It means that if you ever rewrite that executable into a non-shell language, you'll either need to modify all callers or live with a misleading name. (Also, if it's bash, ksh, or another shell other than POSIX sh, a `.sh` extension gives a misleading/incorrect signal about which interpreters it's compatible with). – Charles Duffy Apr 26 '16 at 23:30

1 Answers1

3

The script name is in bash's command-line, it's just ps doesn't display it by default. You can use ps -f to print the full argument list.

$ ps -f
jkugelm+  28798   9819  0 16:17 pts/0    00:00:00 /bin/bash ./myProcess.sh
John Kugelman
  • 349,597
  • 67
  • 533
  • 578