I have PID file and I want to get PID number so this is what I am doing.
[root@linux ~]# PID=`cat /usr/local/foo/var/run/foo.pid` [root@linux ~]# echo $PID 3414
sometimes this file doesn't existing and this throwing file error, I want to specify to not throw an error, if file doesn't exist.
[root@linux ~]# PID=`cat /usr/local/foo/var/run/foo.pid` cat: /usr/local/foo/var/run/foo.pid: No such file or directory
I am trying to use
2&> /dev/null but it's not working, what am I doing wrong?