Às 05:00 de 12/10/22, Paulo da Silva escreveu:
Hi!

The simple question: How do I find the full path of a shell command (linux), i.e. how do I obtain the corresponding of, for example,
"type rm" in command line?

The reason:
I have python program that launches a detached rm. It works pretty well until it is invoked by cron! I suspect that for cron we need to specify the full path. Of course I can hardcode /usr/bin/rm. But, is rm always in /usr/bin? What about other commands?

Thank you all who have responded so far.
I think that the the suggestion of searching the PATH env seems the best.
Another thing that I thought of is that of the 'which', but, to avoid the mentioned recurrent problem of not knowing where 'which' is I would use 'type' instead. 'type' is a bash (sh?) command.

Thanks
Paulo


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to