Re: putting something into single quotes in a bash script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2011-02-02 at 13:43 -0700, Petrus de Calguarium wrote:
> What is the difference in a bash script when one places something between 
> single quotes:
> 
> - using the apostrophe, '
> - using the accent grave, `
> 
> ?
> 
> Eg.,
> 
> ps -fu 'whoami'
> ps -fu `whoami`
> 
> They produce entirely different results.

Of course they do. They are entirely different things. The first one is
for quoting strings which might contain Shell metacharacters. The second
is to execute a command and insert its output as the value of the
string, e.g.

ls -l `find ~/.kde`

This is equivalent to:

ls -l $(find ~/.kde)

but the latter is a more recent form (it has the advantage of being
nestable, which the older form isn't).

And then there's the difference between " and ' ...

I recommend reading up on bash to fully understand this last part. It's
not trivial to explain.

poc

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux