Re: OT: need bash help [solved]
- From: Pete Travis <me@xxxxxxxxxxxxxx>
- Date: Mon, 17 Oct 2011 14:06:43 -0600
Backticks for a subshell are 'depricated' though the convention is still in
wide use. I use the $() method because `su - user 'command --opt="foo"'`
and such can get a bit confusing, and the alternative is much easier to
pick out of a mass of text.
On Oct 17, 2011 1:45 PM, "Mike Wright" <mike.wright@xxxxxxxxxxxxxx> wrote:
On 10/17/2011 12:39 PM, Mike Wright wrote:--
Hi all,
I'm trying to write a bash script and having problems.
If I execute this:
ps x | grep mongod | wc -l
it returns a value.
OTOH, if I execute this:
LINES = ps x | grep mongod | wc -l
it returns "command not found".
How does one assign the output of a command to an environment variable?
Aaargh! Doesn't like the spaces around the = sign.
LINES=`ps x | grep mongod | wc -l` is a way to write it.
Sorry for the noise :/
--
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
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
- References:
- OT: need bash help
- From: Mike Wright
- Re: OT: need bash help [solved]
- From: Mike Wright
- OT: need bash help
- Prev by Date: Re: HELP!!! System messed up!
- Next by Date: Re: doc question on private network IP allocation
- Previous by thread: Re: OT: need bash help [solved]
- Next by thread: Re: OT: need bash help [solved]
- Index(es):
Relevant Pages
|