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]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux