Re: combining the result of processing various commands and setting it in a variable
From: onetitfemme (onetitfemme2005_at_yahoo.com)
Date: 11/19/05
- Next message: Kenny McCormack: "Security of 'locate' command (Was: Re: Linux locate command)"
- Previous message: Michael Tosch: "Bug in awk?"
- In reply to: Stephane CHAZELAS: "Re: combining the result of processing various commands and setting it in a variable"
- Next in thread: Stephane CHAZELAS: "Re: combining the result of processing various commands and setting it in a variable"
- Reply: Stephane CHAZELAS: "Re: combining the result of processing various commands and setting it in a variable"
- Reply: Janis Papanagnou: "Re: combining the result of processing various commands and setting it in a variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 19 Nov 2005 05:08:56 -0800
All right.
of the 4 examples I got from you only the first one proposed by Lars,
didn't work.
// __ grep: version: No such file or directory
_VER="Linux version";
_CHKVER="`dmesg | grep -i ${_VER}`";
echo ${_CHKVER};
// __ OK!
_VER="Linux version";
_CHKVER=$(dmesg | grep -i "${_VER}");
echo ${_CHKVER};
// __ OK!
_VER="Linux version";
_CHCKVER=`dmesg | grep -i "$_VER"`;
echo ${_CHKVER};
// __ OK!
_VER="Linux version";
_CHCKVER=$(dmesg | grep -iF -- "$_VER");
echo ${_CHKVER};
Obviously I need to read more about "grep" and command shell scripting
Now, which of the working versions of the script is the most portable
one?
The last one as given by Stéphane?
I need for the script to hopefully work on any Unix and Linux
versions. Right now I am testing it with Linux/Debian/Knoppix
Thanks
otf
- Next message: Kenny McCormack: "Security of 'locate' command (Was: Re: Linux locate command)"
- Previous message: Michael Tosch: "Bug in awk?"
- In reply to: Stephane CHAZELAS: "Re: combining the result of processing various commands and setting it in a variable"
- Next in thread: Stephane CHAZELAS: "Re: combining the result of processing various commands and setting it in a variable"
- Reply: Stephane CHAZELAS: "Re: combining the result of processing various commands and setting it in a variable"
- Reply: Janis Papanagnou: "Re: combining the result of processing various commands and setting it in a variable"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|