Bourne shell question

From: C.Ruhnke <i769646_at_smrs013a.mdc.com>
Date: Fri, 21 May 1999 15:03:17 -0500 (CDT)

Gurus and wizards,

I am NOT a shell expert (yet!), so I may just be misunderstanding this...

I expect the following script to set the variable mydir to the current
working directory. If I run it under the Korn shell, it does what
I expect. If I run it under Bourne shell, then mydir echoes as empty.


#!/usr/bin/ksh
#
# This does not seem to work using sh but does for ksh
#
pwd | read mydir
echo $mydir

The man pages for "read" don't indicate any variation due to shell.
Is this the expected function of "sh" and "ksh"?

--CHRis
-
=============================================================================
Chris H. Ruhnke Phone: (314)233-7314
IBM Global Services M/S S306-6340 FAX : (314)234-2262
325 J.S. McDonnell Blvd Email: Ruhnke_at_US.ibm.com
Hazelwood, MO 63042
Received on Fri May 21 1999 - 20:05:31 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:39 NZDT