NetBSD-Users archive

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

/bin/sh question



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  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index