[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ExecResult not working as expected
From: |
Chip Seraphine |
Subject: |
Re: ExecResult not working as expected |
Date: |
Fri, 26 Mar 2004 13:33:43 -0600 |
User-agent: |
KMail/1.5.4 |
I've had issues with variables inside functions and found that using curly
braces helps, e.g.
cpu_info = ( ExecResult(${mirror_scripts}/rsync-cpuinfo.sh) )
in lieu of
cpu_info = ( ExecResult($(mirror_scripts)/rsync-cpuinfo.sh) )
On Friday 26 March 2004 11:33, Kurt Lieber wrote:
> At least, it's not working as I'd expect it to. I need to parse out some
> cpu information for a motd banner. I'm trying to use ExecResult to set
> this to a variable. So far, I've tried three different commands:
>
> cpu_info = ( ExecResult("/bin/cat /proc/cpuinfo | /bin/grep model\ name
| /bin/cut -d : -f 2 | /bin/uniq -c | /bin/sed 's/\([0-9]\{1\}\)[[:space:]]
\+\(.*\)/\1 x \2/'") )
> cpu_info = ( ExecResult($(mirror_scripts)/rsync-cpuinfo.sh) )
> cpu_info = ( ExecResult(/full/path/to/scripts/rsync-cpuinfo.sh) )
>
> Of those, only the last one works. (rsync-cpuinfo.sh only contains a
shebang line and the above long shell command)
>
> The first two simply output the value of cpu_info as a literal string.
So, instead of printing "1 x AMD Athlon(tm) MP 2400+: which is what I'd
expect, I get:
>
> ExecResult(/full/path/to/scripts/rsync-cpuinfo.sh)
>
> I also tried the first command with and without double and single quotes
surrounding it.
>
> What am I doing wrong?
>
> --kurt
>