ALT Linux sysadmins discussion
 help / color / mirror / Atom feed
* [Sysadmins] bash | read
@ 2008-01-17 19:43 Michael Shigorin
  2008-01-18  9:44 ` Michael Shigorin
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Shigorin @ 2008-01-17 19:43 UTC (permalink / raw)
  To: sysadmins

	Здравствуйте.
Хозяйке на заметку (спасибо raorn@ за снятие с ручника насчёт subshell):

$ zsh
$ echo test | read a; echo $a
test
$ bash
$ echo test | read a; echo $a                                       

$ echo test | ( read a; echo $a )
test
$ 

При этом что-нить вроде такого работает, как ожидается:

| while read first second junk; do
	# something with $first (first IFS-delimited word)
	# ...and with $second too...
	# the rest of the line goes to $junk
done

-- именно потому, что тут-то всё выполняется в одном сабшелле ;)

А, и ещё:

$ echo test:best | ( IFS=: read a b; echo $a/$b )
test/best

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/


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

end of thread, other threads:[~2008-01-18  9:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-17 19:43 [Sysadmins] bash | read Michael Shigorin
2008-01-18  9:44 ` Michael Shigorin

ALT Linux sysadmins discussion

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sysadmins/0 sysadmins/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 sysadmins sysadmins/ http://lore.altlinux.org/sysadmins \
		sysadmins@lists.altlinux.org sysadmins@lists.altlinux.ru sysadmins@lists.altlinux.com
	public-inbox-index sysadmins

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


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