sometimes I need to follow a process and I always find a bash-script doing pid=$1
. As far as I understand, it should get the process ID that I sent to the first shell instance I created that is running that particular process, and I could use it later (for instance, to kill it, or follow memory usage, or whatever). pid=$0
should get the current instance (bash) and pid=$!
the latest one. (Please, correct if I'm wrong)
Problem is: every time I need to run pid=$1
command, pid
gets nothing and echo $pid
or echo ${pid}
prints and empty line, I always need to fancy a way of doing it using pid=$!
instead, since it's the only thing that gets my process ID. Does anyone know why my terminals behavior like that? (it's happening either in Linux Mint or in Fedora)