Quick Shell script question

Thierry ITTY thierry.itty at besancon.org
Fri Jun 4 14:16:08 UTC 2004


test1=$(pwd)

much readable than backticks (test1=`pwd`), less confusing, avoids typos, etc

hth


A 11:46 03/06/2004 -0400, vous avez écrit :
>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'
>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.
>
>
>-- 
>redhat-list mailing list
>unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
>https://www.redhat.com/mailman/listinfo/redhat-list
>
>





More information about the redhat-list mailing list