On Fri, Jun 23, 2000 at 08:51:44PM -0400, Peter Kovacs wrote:
> On Sat, 24 Jun 2000, Mark Phillips wrote:
> > for f in $(cd....
>
> From man 1 bash:
> Command Substitution
> Command substitution allows the output of a command to
> replace the command name. There are two forms:
>
> $(command)
> or
> `command`
>
> That's why I had the backticks in there. I've never seen the
> $() construct either.
The key difference is that $( command list ) is nestable without
quoting, backticks are not.
If you've ever written:
$ foo `bar \`baz qux\` `
...nested to several levels, you'll appreciate:
$ foo $( bar $( baz qux ) )
...it becomes trivial to build complex expressions interatively on the
command line with command-line editing, without having to worry about
quoting backticks and such.
The functionality is common in a number of shells other than bash,
though I'm not quite sure which. I believe the Unix posix-compliant
(bastardized korn) and possibly korn shells support it.
--
Karsten M. Self <kmself@ix.netcom.com> http://www.netcom.com/~kmself
Evangelist, Opensales, Inc. http://www.opensales.org
What part of "Gestalt" don't you understand? Debian GNU/Linux rocks!
http://gestalt-system.sourceforge.net/ K5: http://www.kuro5hin.org
GPG fingerprint: F932 8B25 5FDD 2528 D595 DC61 3847 889F 55F2 B9B0
Attachment:
pgpEhM5QM_U1w.pgp
Description: PGP signature