ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Sviatoslav Sviridov <svd@altlinux.ru>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] Re: ... bash
Date: Thu, 12 Jan 2006 19:05:46 +0200
Message-ID: <43C68C6A.5000600@altlinux.ru> (raw)
In-Reply-To: <43C6714C.2040008@vzljot.ru>

Vitaly Ostanin wrote on 1/12/2006 5:10 PM:
>>>> while read var; do
>>>> ...
>>>> done < infile
>>> А как то же самое сделать для переменной (содержащей список
>>> строк) вместо infile ? У меня не заработал ни один из вариантов.
>> ls -d1| \
>> while read l
>> do
>> 	ls -l "$l"
>> done
>
> Исходная задача в изменении глобальной переменной внутри while. В
> этом примере while после |, и переменные родительскому процессу
> не возвращаются.
>
> Из
> http://www.tldp.org/LDP/abs/html/
> я так понял, что единственный вариант - дописывание значений
> внутри while в файл, и потом чтение этого файла родительским
> процессом.
Ну почему же...
Извините, пропустил начало дискуссии... но может угадаю чего надо? ;)

Из процитированного понял, что надо чтобы while выполнялся в
родительском процессе и при этом читал вывод другого процесса? что-то
типа вот этого:

$ list="line1
> line2
> line3"
$ a=qqq
$ while read l; do a="$l"; done < <(echo "$list")
$ echo $a
line3

Так пойдет?

-- 
Best Regards,
Sviatoslav Sviridov



  reply	other threads:[~2006-01-12 17:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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               ` Sviatoslav Sviridov [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43C68C6A.5000600@altlinux.ru \
    --to=svd@altlinux.ru \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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