Quoth Chad Perrin on Wednesday, 27 October 2010:
I know that in sh you can get the contents out of files specified as
command line arguments:
while read data; do
echo $data
done $@
I know you can also get the contents of files from pipes and redirects:
while read
On Thu, Oct 28, 2010 at 08:11:48AM -0700, Chip Camden wrote:
Here's a way to do what you're wanting to do. Unfortunately, it isn't a
generalized, single construct:
#!/bin/sh
if [ $# -ge 1 ];then
exec cat $@ | $0
exit
fi
while read data; do
echo $data
done
My lame attempts
Quoth Chad Perrin on Thursday, 28 October 2010:
On Thu, Oct 28, 2010 at 08:11:48AM -0700, Chip Camden wrote:
Here's a way to do what you're wanting to do. Unfortunately, it isn't a
generalized, single construct:
#!/bin/sh
if [ $# -ge 1 ];then
exec cat $@ | $0
exit
fi
On Wed, 2010-10-27 at 15:28 -0600, Chad Perrin wrote:
I know that in sh you can get the contents out of files specified as
command line arguments:
while read data; do
echo $data
done $@
I know you can also get the contents of files from pipes and redirects:
while
On Thu, 28 Oct 2010 09:17:12 -0700, Chip Camden sterl...@camdensoftware.com
wrote:
Perhaps someone with more sh fu can transform the
'if' paragraph into a one-liner at least. When I tried to do so, I got an
unexpected ; error.
Not tested, but this should do the trick:
#!/bin/sh
On Thu, 28 Oct 2010 19:28:26 +0200, Polytropon free...@edvax.de wrote:
On Thu, 28 Oct 2010 09:17:12 -0700, Chip Camden sterl...@camdensoftware.com
wrote:
Perhaps someone with more sh fu can transform the
'if' paragraph into a one-liner at least. When I tried to do so, I got an
unexpected
Quoth Polytropon on Thursday, 28 October 2010:
On Thu, 28 Oct 2010 09:17:12 -0700, Chip Camden sterl...@camdensoftware.com
wrote:
Perhaps someone with more sh fu can transform the
'if' paragraph into a one-liner at least. When I tried to do so, I got an
unexpected ; error.
Not tested,
On Thu, 28 Oct 2010 09:17:12 -0700,
Chip Camden sterl...@camdensoftware.com said:
C Perhaps someone with more sh fu can transform the 'if' paragraph into a
C one-liner at least. When I tried to do so, I got an unexpected ; error.
Try this:
#!/bin/sh
test $# -ge 1 cat $@ | exec
Quoth Karl Vogel on Thursday, 28 October 2010:
On Thu, 28 Oct 2010 09:17:12 -0700,
Chip Camden sterl...@camdensoftware.com said:
C Perhaps someone with more sh fu can transform the 'if' paragraph into a
C one-liner at least. When I tried to do so, I got an unexpected ; error.
Try
On Thu, 2010-10-28 at 09:17 -0700, Chip Camden wrote:
Quoth Chad Perrin on Thursday, 28 October 2010:
On Thu, Oct 28, 2010 at 08:11:48AM -0700, Chip Camden wrote:
Here's a way to do what you're wanting to do. Unfortunately, it isn't a
generalized, single construct:
#!/bin/sh
I was hoping for a generalized, simple idiom for this, rather than
needing to implement it myself, for demonstration purposes
#!/bin/sh
cat $@ |
while read x
do
echo I saw $x
done
Sheesh.
R's,
John
Quoth John Levine on Thursday, 28 October 2010:
I was hoping for a generalized, simple idiom for this, rather than
needing to implement it myself, for demonstration purposes
#!/bin/sh
cat $@ |
while read x
do
echo I saw $x
done
On Thu 28 Oct 2010 at 13:52:27 PDT Chip Camden wrote:
stage_directionSmacks forehead as if starring in a V-8
commercial/stage_direction
A friend of mine used to call that a Neanderthal Moment.
(Smack your forehead, shrug your shoulders, and imagine it is reshaping
your body.)
I know that in sh you can get the contents out of files specified as
command line arguments:
while read data; do
echo $data
done $@
I know you can also get the contents of files from pipes and redirects:
while read data; do
echo $data
done
In Perl, you can use a
On Wed, 27 Oct 2010 15:28:41 -0600,
Chad Perrin per...@apotheon.com said:
C In Perl, you can use a single construct to [read files or pipes], and it
C can also take multiple filenames as arguments and effectively
C concatenate their contents:
C while () { print $_; }
C Please let me know if
15 matches
Mail list logo