Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 2001 01:32:48 +0900 (JST)
From:      imura@af.airnet.ne.jp
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/24228: /bin/sh problem : variable after pipeline won't be set
Message-ID:  <200101101634.BAA109788@mail.af.airnet.ne.jp>

next in thread | raw e-mail | index | archive | help

>Number:         24228
>Category:       bin
>Synopsis:       when using /bin/sh, setting variable after pipeline won't work
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jan 10 08:40:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Ryuichiro Imura
>Release:        FreeBSD 4.2-STABLE i386
>Organization:
>Environment:

FreeBSD 4.2-STABLE

>Description:

When using /bin/sh, setting variables after "|"
(in other words, I mean setting variables in a pipeline sequence),
will be ignored out of the pipeline sequence.

If it is a definition of /bin/sh, it's ok, I'm sorry,
otherwise I think it should be fixed.

>How-To-Repeat:

write a simple shell script like this:
-----------starts here----------
#/bin/sh

cat FILE | while read line ; do
	if [ $line = foo ]; then
		variable=bar
	fi
	echo $variable   <---- this will be printed
done

echo $variable           <---- this will NOT be printed
-----------ends here------------

>Fix:

Sorry, this is only a information of my problem.


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101101634.BAA109788>