NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: /bin/sh question



On 7/29/12 11:28 AM, Paul Goyette wrote:
Just out of curiousity, is there a reason why the following does not work? It generates "Symbol =" as output...

    #! /bin/sh

    echo "value" |
      read symbol
    echo "Symbol = $symbol"

Yet it does work if you do it as follows, generating the expected output "Symbol = value"

    #! /bin/sh
    echo "value" |
    ( read symbol
      echo "Symbol = $symbol" )



-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------
I see the first example as:

( echo "value" | read symbol )
echo "Symbol = $symbol

--
Ron McDowell
San Antonio TX



Home | Main Index | Thread Index | Old Index