Re: Using terminal output as input
On Sun, May 17, 2009 at 01:11:54PM +0000, Tzafrir Cohen wrote:
> On Sun, May 17, 2009 at 08:51:38AM -0300, Eduardo M KALINOWSKI wrote:
>
> > As other people have pointed out, the way to capture a command's output
> > is with $(command) (or `command`, though this is a bashism).
>
> $(command) is bashism. `command` is the "pure" bourne shell form.
>
> And likewise on dash and busybox ash, which are the other shells I have
> here. IIRC latest posix includes $(command) as well.
It is definitely *not* a bashism, given that it is supported by POSIX.
It is supported by all POSIX shells, and this does include dash.
You should definitely use $() in place of backticks where possible, and
portability concerns are unwarranted here given that all real shells
include support for it. posh is an exception, but is not a POSIX shell
since it does not support this POSIX feature.
Regards,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
Reply to: