Quick Shell script question

Ed Greshko Ed.Greshko at greshko.com
Thu Jun 3 15:50:10 UTC 2004


On Thu, 2004-06-03 at 23:46, Henry Axelrod wrote:
> I have been trying to do something that seems that it should be very
> simple in a shell script. I am trying to make a variable equal to the
> output of a command. The command started off very complex but I created
> a test script to bring it down to it's most simple form and it still
> does not work. Here is the test script:
> 
> #!/bin/bash
> # test script
> 
> test1='pwd'

you want...

test1=`pwd`

> echo $test1
> 
> when in this format the test1 variable echo's the word pwd instead of
> the current directory.
> I have also tried
> test1= 'pwd'      # test1 is null and command executes
> I am almost positive I have done this before in a script. 
> Any help would be appreciate.
> 
> Linux AS 2.1 Kernel 2.4.9-e.35
> _____________
> LEGAL NOTICE
> Unless expressly stated otherwise, this message is confidential
> and may be privileged. It is intended for the addressee(s) only.
> Access to this E-mail by anyone else is unauthorized.
> If you are not an addressee, any disclosure or copying of the
> contents of this E-mail or any action taken (or not taken) in
> reliance on it is unauthorized and may be unlawful. If you are not an
> addressee, please inform the sender immediately, then delete this
> message and empty from your trash.
-- 
"An opinion is like an asshole - everybody has one."
    - Clint Eastwood as Harry Callahan, The Dead Pool - 1988.





More information about the redhat-list mailing list