[comp.unix.questions] stupid unix commands

daniel@island.uu.net (Dan Smith "fast screens, loud music, slow car") (05/02/90)

[ongoing discussion about "yes" threatening to get out of hand at the
drop of a byte...]

	I've found "yes" does have a use for generating a list of numbers
in a shell script, a la:

	yes "" | cat -n | head -20 | tail -10

				Daniel
-- 
   dansmith@well.sf.ca.us   daniel@island.uu.net   unicom!daniel@pacbell.com
ph: (415) 332 3278 (h), 491 1000 (w) disclaimer: Island's coffee was laced :-)

jik@athena.mit.edu (Jonathan I. Kamens) (05/03/90)

In article <1574@island.uu.net>, daniel@island.uu.net (Dan Smith "fast
screens, 
loud music, slow car") writes:
|> 	I've found "yes" does have a use for generating a list of numbers
|> in a shell script, a la:
|> 
|> 	yes "" | cat -n | head -20 | tail -10

  Perhaps you should consider using the right tool for the job.... What
you do here in 4 processes and a whole bunch of context switching, I can
do in one:

	jot 10 11

Jot is available as part of BSD, although it doesn't appear to be among
the freely redistributable sources on uunet (which is strange, because
the copyrights at the top of the sources say that it was written by a
UCB person; oh, well, perhaps the CSRG people just haven't gotten around
to checking it for proprietary code and changing the copyright at the
top to the new Berkeley "freely redistributable" copyright).

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710

merlyn@iwarp.intel.com (Randal Schwartz) (05/03/90)

In article <1574@island.uu.net>, daniel@island (Dan Smith "fast screens, loud music, slow car") writes:
| 	I've found "yes" does have a use for generating a list of numbers
| in a shell script, a la:
| 
| 	yes "" | cat -n | head -20 | tail -10

Gack.  Get Perl:

perl -e 'for (11..20) {printf "%6d\n",$_;}'

...if you need the leading whitespace, and...

perl -e '@a=11..20; print "@a"'

if you just want whitespace separated values.

print "Just another Perl hacker,"
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/

thor@stout.atd.ucar.edu (Rich Neitzel) (05/03/90)

In article <1574@island.uu.net>, daniel@island.uu.net (Dan Smith "fast
screens, loud music, slow car") writes:
|>
|>[ongoing discussion about "yes" threatening to get out of hand at the
|>drop of a byte...]
|>
|>	I've found "yes" does have a use 
Me too - if you alias rm to "rm -i":

yes | rm foo*
             
Richard Neitzel thor@thor.atd.ucar.edu	     	Torren med sitt skjegg
National Center For Atmospheric Research	lokkar borni under sole-vegg
Box 3000 Boulder, CO 80307-3000			Gjo'i med sitt shinn
303-497-2057					jagar borni inn.

daniel@island.uu.net (Dan Smith "Happy Birthday James Brown G.O.S.") (05/04/90)

In article <1990May2.170711.16545@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes:
>|> 
>|> 	yes "" | cat -n | head -20 | tail -10
>
>  Perhaps you should consider using the right tool for the job.... What
>you do here in 4 processes and a whole bunch of context switching, I can

	Yea, I know, I know, and perl is *god* too!  I appreciate that
(and do use perl).  I'm just showing an example that is likely to work
on Unix systems everywhere.  Someone else's posting of "yes | rm -i foo*"
was amusing :-)

	I'll toss out a slightly different subject:  what was the
most obfuscated line you've ever put in a shell (any type) script?

				Daniel
-- 
   dansmith@well.sf.ca.us   daniel@island.uu.net   unicom!daniel@pacbell.com
ph: (415) 332 3278 (h), 491 1000 (w) disclaimer: Island's coffee was laced :-)

scott@cs.odu.edu (Scott Yelich) (05/04/90)

>   |> 	I've found "yes" does have a use for generating a list of numbers
>   |> in a shell script, a la:

Shell?

>   |> 	yes "" | cat -n | head -20 | tail -10
>     Perhaps you should consider using the right tool for the job.... What
>   you do here in 4 processes and a whole bunch of context switching, I can
>   do in one:
>	   jot 10 11



And people say I don't have a sense of humor..... Any use of ``yes,'' in my
opinion, is humorous [I may be wrong... but I thought that original post was
an attempt at humor... and I laughed for a good minute when I read it!]

I hope I was mistaken......
--

 -----------------------------------------------------------------------------
 Scott D. Yelich                         scott@[xanth.]cs.odu.edu [128.82.8.1]
 After he pushed me off the cliff, he asked me, as I fell, ``Why'd you jump?''
 Administrator of:    Game design requests to <game-design-request@cs.odu.edu>
 -----------------------------------------------------------------------------

shwake@raysnec.UUCP (Ray Shwake) (05/05/90)

In article <1990May2.170711.16545@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes:
>  Perhaps you should consider using the right tool for the job.... What
>you do here in 4 processes and a whole bunch of context switching, I can
>do in one:
>
>	jot 10 11

For those who don't have access to jot, I picked up from the net recently
the 'count' program which ostensibly accomplishes the same thing. It works
for me.