putting something into single quotes in a bash script

Michael Cronenworth mike at cchtml.com
Wed Feb 2 20:51:19 UTC 2011


Petrus de Calguarium wrote:
> ps -fu 'whoami'

This just passes the text whoami as a group argument with no execution 
of whoami.

ps -fu whoami
^
Equivalent command

> ps -fu `whoami`

The accent graves tell bash to execute the text inside them. The whoami 
command will be executed then passed to ps -fu.



More information about the users mailing list