I'm writing a cross platform bash script. It needs to use this command #1:
cat /proc/$PID/cmdline
and if the procfs is not available (on OS X for example), it needs to fallback to this command #2:
ps -eo "pid command" | grep "^$PID"
My question is pretty simple: what is the correct way to detect if '/proc' file system exists?