Thread View: comp.unix.shell
1 messages
1 total messages
Started by Wm E Davidsen Jr
Fri, 28 Sep 1990 19:15
piping into read in ksh
Author: Wm E Davidsen Jr
Date: Fri, 28 Sep 1990 19:15
Date: Fri, 28 Sep 1990 19:15
28 lines
1406 bytes
1406 bytes
This saved me a lot of time when I found it. Works in ksh, someone
could let me know if it works in bash.
#!/bin/ksh
# This is a demo of piping stuff into read to break it into parts
# using ksh piping a command into read. ksh doesn't use a subshell for
# this, so the values read are preserved.
#
# this is often done with set, which messes up the arguments
# this is a demo of copying news articles and concatenating several
# in some cases, using the number of the first article as the
# destination filename. The names are fixed because (a) you normally
# do this interractively, and (b) it's only a demo.
for n in 101 "102 105 117" 200 212 "214 238 261" 302
do
echo $n | read first1 rest
echo "(cd /news-spl/comp/misc;cat $n) > myrefs/$first1"
done
# author: Bill Davidsen (davidsen@crdos1.crd.ge.com)
--
bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
VMS is a text-only adventure game. If you win you can use unix.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads