ALT Linux Team development discussions
 help / color / mirror / Atom feed
* [devel] О присваивании переменных в циклах на bash
@ 2005-12-27  8:07 Vitaly Lipatov
  2005-12-27  8:19 ` Sergey Pinaev
  0 siblings, 1 reply; 22+ messages in thread
From: Vitaly Lipatov @ 2005-12-27  8:07 UTC (permalink / raw)
  To: ALT Devel discussion list

Простая программа:

TEST=orig
for i in first ; do
        TEST=new
done
echo $TEST

Какое слово она выведет? Конечно же
new


А вот эта?
TEST=orig
echo first | while read i ; do
        echo "HEHE"
        TEST=new
done
echo $TEST

Вот и не угадали - выведен она 
HEHE
orig


В /usr/bin/sisyphus_relink наблюдаем такой код:
    cat "$list" |while read n; do
        f="files/$rfiles/$n"
        [ -f "$f" ] || continue
        $debug ln -s $verbose "$r/$n" "$d/" || rc=1
    done
    return $rc

получается rc тоже не присвоится и в коде ошибка?

Но как же всё таки присваивать переменные внутри таких циклов?

-- 
Lav
Виталий Липатов
Санкт-Петербург
GNU! ALT Linux Team! WINE! LaTeX! LyX! http://freesource.info


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2006-01-13 13:19 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-27  8:07 [devel] О присваивании переменных в циклах на bash Vitaly Lipatov
2005-12-27  8:19 ` Sergey Pinaev
2005-12-27  8:29   ` Alexey I. Froloff
2005-12-27  9:05     ` Vitaly Lipatov
2005-12-27  9:10       ` Sergey Pinaev
2005-12-27  9:37         ` [devel] " Vitaly Ostanin
2005-12-27  9:41           ` Sergey Pinaev
2005-12-27 10:03             ` Vitaly Ostanin
2005-12-27 10:04             ` Aleksey Avdeev
2005-12-27 12:53               ` Ivan Fedorov
2005-12-27 13:22                 ` Aleksey Avdeev
2005-12-27 13:57                   ` Ivan Fedorov
2005-12-28 12:25           ` Sergey V Turchin
2006-01-12 15:10             ` [devel] Re: н ОПХЯБЮХБЮМХХ ОЕПЕЛЕММШУ Б ЖХЙКЮУ МЮ bash Vitaly Ostanin
2006-01-12 17:05               ` [devel] Re: ... bash Sviatoslav Sviridov
2006-01-13 10:29                 ` [devel] bash Vitaly Ostanin
2006-01-13 10:43                   ` Sviataslau Svirydau
2006-01-13 11:50                     ` Vitaly Ostanin
2006-01-13 13:19                       ` Dmitry V. Levin
2005-12-27  8:30   ` [devel] О присваивании переменных в циклах на bash Vitaly Lipatov
2005-12-27  8:33     ` Sergey Pinaev
2005-12-27 20:27     ` Denis Ovsienko

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git