HDTenEightyP/NetNews huggingface dataset:
From: epc1@ellis.uchicago.edu (Merlin)
Subject: getting status of mt operation
Reply-To: epc1@midway.uchicago.edu
Organization: University of Chicago Computing Organizations
Date: Wed, 16 Dec 1992 23:04:07 GMT


I am attempting to determine whether I have come to an end of a tape
in a shell script.  Because dd asks for the insertion of another
tape at the end, I am doing the following:

     if ((@ status = `mt -f /dev/nrmt0l fsf 1`) == 0) then
       `mt -f /dev/nrmt0l bsf 2`
       `mt -f /dev/nrmt0l fsf 1`
       `dd if=/dev/nrmt0l bs=20b of=$argv[1]`
     else 
	echo "done"
     endif

However, at the end of the tape, I just get the following message:
  /dev/nrmt0l fsf 1 failed: I/O error

In addition status does not return 2!  I still get a 0 despite this error.

WHAT can I do???
Anybody have a solution???

Newsgroups: comp.unix.shell
From: dlreed@highlite.uucp (David L. Reed)
Subject: Re: Reading a line from a file in Bourne
Organization: Gotham Communications Research
Distribution: usa
Date: Mon, 14 Dec 1992 23:34:39 GMT

shutton@fokker.union.indiana.edu (Scott K. Hutton) writes:

>I've received a lot of good advice, both through e-mail and followups.
>The bottom line (while I did receive lots of  innovative solutions) is
>to do something akin to the following:

>#!/bin/sh
>cat myfile |
>while read LINE
>do
> echo a full line: $LINE
>done

This is good, but avoid a pipe if possible.               

The alternative that has worked best for me is to let while take
stdin directly from the file:

#!/bin/sh
while read LINE
do
 echo a full line: $LINE
done < myfile

>"read"  apparently has a  significant return value--major goof  on  my
>part for failing to check this.

>-S
-- 
David L. Reed:  dlreed@gotham.com  dlreed@highlite.uucp  uunet!highlite!dlreed
         Come join us at highlite... Public Access Unix for DC/MD/VA.
   D.C. Metro (301)924-5998, Comms set to 8N1.  login: guest  passwd: guest 
     Taking calls at 1200/2400/9600+ (V.32bis/V.42bis w/error correction)   
Newsgroups: comp.unix.shell
From: xiaobing@cs.sfu.ca (Xiaobing Chen)
Subject: timing piped commands
Organization: CSS, Simon Fraser University, Burnaby, B.C., Canada
Date: Sat, 19 Dec 1992 01:02:01 GMT

Anybody tell me how to 'time' piped commands like:
	% time 'ls -lR | fgrep root'	# failed of course

( This comes from my trying to find which way is faster in looking
for some directory entries using the above format and 'find',
like 'find . -owner root -print'
If you know this answer, please also tell me.
)

Thank you in advance.

xiaobing@cs.sfu.ca

Newsgroups: comp.unix.shell
From: dws@ssec.wisc.edu (DaviD W. Sanderson)
Subject: Re: rsh terminates while loop
Organization: UW-Madison Space Science and Engineering Center
Date: Wed, 16 Dec 1992 19:06:54 GMT

In article <1992Dec16.163349.16919@crd.ge.com> davidsen@crd.ge.com (bill davidsen) writes:
>However, it seems that what I tried was:
>  result=`rsh $host uname $flags` < /dev/null
>rather than
>  result=`rsh $host uname $flags < /dev/null`
>which works.
>
>This is somewhat non-intuitive,
...
>it's clear that redirection within the quotes will protably work,
>even if it's not as clear that redirection outside the quotes doesn't.

Let me explain.

The shell (sh/ksh anyway) expands command substitutions in a 'simple
command' (to use the man page terminology) prior to executing the
resulting 'simple command' or processing its i/o redirections.  This
makes sense, because if i/o redirections for a 'simple command' ALSO
applied to its command substitutions then

	ls -l `echo *.c` > foo

would redirect the result of the 'echo *.c' into the file 'foo' instead
of making the result of the echo part of the 'ls' command line.  The
shell would then run the 'ls -l' command with no additional arguments,
also with its output redirected to the file 'foo'.  Fortunately, this
is NOT what the shell actually does.

So, to return to the rsh example, in the command

	result=`rsh $host uname $flags` < /dev/null

the redirection applies to the 'simple command' (which in this
particular case happens to be an assignment), not the rsh.  When the
shell executes the rsh it has not yet processed the redirection.  Since
assignments neither read nor write any file descriptors, the i/o
redirection for the assignment happens to have no effect on the
assignment itself.  On the other hand, in the command

	result=`rsh $host uname $flags < /dev/null`

the redirection is part of the command the shell executes when it
expands the command substitution in the assignment 'simple command', so
the redirection DOES apply to the rsh in this case.

DaviD W. Sanderson (dws@ssec.wisc.edu)
Organization: The American University - University Computing Center
Date: Tue, 15 Dec 1992 16:25:32 EST
From: James D. Watson <JW1675A@auvm.american.edu>
Newsgroups: comp.unix.shell
Subject: "unset" variables under ultrix bourne shell

Hi!  I'm writing UNIX administration scripts and some will be
sourced.  I don't want to leave any trace of them after they exit. On a
Sun (BTW, all my scripts are /bin/sh) I can unset a previously defined
variable with "unset VARNAME".  How can I do this on a DEC/5000 (again
using /bin/sh)?  I know I can "VARNAME=''" but if I run "set" from the
command line, I'll see "VARNAME=".  (On the Sun, unset gets cleans the var
out of the environment.)

Thanks in advance.  (E-mail and posted answers are fine.)
Jim
From: davidsen@ariel.crd.GE.COM (william E Davidsen)
Newsgroups: comp.unix.shell
Subject: Re: rsh terminates while loop
Date: 16 Dec 92 16:33:49 GMT
Reply-To: davidsen@crd.ge.com (bill davidsen)
Organization: GE Corporate R&D Center, Schenectady NY

In article <1992Dec15.054605.6780@cs.wisc.edu>, dws@ssec.wisc.edu (DaviD W. Sanderson) writes:

| Redirect the rsh input from /dev/null:
| 
| 	#!/bin/sh
| 	while	read host flags
| 	do	result=`rsh $host uname $flags < /dev/null`
| 		echo "$host: $result"
| 	done

  I told several people who mailed me suggestions to redirect the input
that I had tried it before posting. However, it seems that what I tried
was:
  result=`rsh $host uname $flags` < /dev/null
rather than
  result=`rsh $host uname $flags < /dev/null`
which works.

  This is somewhat non-intuitive, and seems to contradict what the man
pages say, although I couldn't find anywhere in which the context of the
`expression` was clearly stated as being (or not being) effected by
redirection.

  Thanks to the people who mailed solutions to me, it's clear that
redirection within the quotes will protably work, even if it's not as
clear that redirection outside the quotes doesn't.

-- 
bill davidsen, GE Corp. R&D Center; Box 8; Schenectady NY 12345
    Keyboard controller has been disabled, press F1 to continue.
Newsgroups: comp.unix.shell
From: john@iastate.edu (John Hascall)
Subject: foreach in csh alias (possible?)
Organization: Iowa State University, Ames, IA
Date: Fri, 18 Dec 1992 20:18:23 GMT

Well, I Read The Fine FAQ, but no mention of this, and I dinked with
it for the better part of an evening, but no luck.  So, is something like
this:

     alias doit 'foreach xx (`list-o-xxs`) \\
          setenv $xx /foo/$xx \\
        end'

possible?

Many thanks,
John
-- 
John Hascall                   ``An ill-chosen word is the fool's messenger.''
Systems Software Engineer
Project Vincent
Iowa State University Computation Center  +  Ames, IA  50011  +  515/294-9551
Newsgroups: comp.unix.shell
From: lwv26@cas.org (Larry W. Virden)
Subject: Re: ksh autoload quirk
Followup-To: comp.unix.shell
Reply-To: lvirden@cas.org (Larry W. Virden)
Organization: Nedriv Software and Shoe Shiners, Uninc.
Date: Sun, 20 Dec 1992 11:16:30 GMT

Here is what our ATT Toolchest man page says about FPATH:

          FPATH
               The search  path  for  function  definitions.   By
               default  the  FPATH directories are searched after
               the PATH  variable.   If  an  executable  file  is
               found, then it is read and executed in the current
               environment.  FPATH is searched before PATH when a
               function with the -u attribute is referenced.  The
               preset alias autoload preset alias (sic) causes a  func-
               tion with the -u attribute to be created.
 
So it sounds like what happens is that first the alias table is searched,
then the currently defined function table is searched, then PATH is searched,
then FPATH is searched.  IF a function is marked with the -u - i.e. autload -
then the last two search items are reversed.
-- 
Larry W. Virden                 UUCP: osu-cis!chemabs!lvirden
Same Mbox: BITNET: lvirden@cas  INET: lvirden@cas.org
Personal: 674 Falls Place,   Reynoldsburg, OH 43068-1614
Newsgroups: comp.unix.shell
From: asriniva@vela.acs.oakland.edu (MONK)
Subject: What's  a shell archive
Organization: Oakland University, Rochester MI.
Date: Fri, 11 Dec 1992 19:21:10 GMT

hi folks

I am just a starter, everytime I browse thru comp.unix.sources,

to get hold of some source codes, I find "its a shell archive"

Can someone explain me what a shell archive means.

email responses to asriniva@vela.acs.oakland.edu

thanks

-- 
_________________________________________________________________________
athi			
_________________________________________________________________________

Newsgroups: comp.unix.shell
From: yorton@turtle11.rtsg.mot.com (James J. Yorton)
Subject: Re: Windowing Korn SHell
Reply-To: yorton@rtsg.mot.com
Organization: Motorola Inc., Cellular Infrastructure Group
Distribution: usa
Date: Mon, 14 Dec 1992 14:45:00 GMT

In article <1992Dec09.151213.14304@spike.insci.com>, brad@spike.insci.com (Brad Segal) writes:
|> Hi,
|>   I'm interested in finding out more about the Windowing Korn Shell 
|> (WKSH, I think) that provides the ability to write X applications in ksh.
|> I know some company in NJ markets it but I'm not sure
|> of the name. What platforms are supported? Any info would be greatly
|> appreciated. Thanks... please send e-mail.

We got our information on it from the AT&T Toolchest in New Jersey.
Their (voice) phone number is (908) 522-6698.

--------------------------------------+---------------------------------------
Jim Yorton                            | Telephone:  +1 708-632-6695
Motorola Inc., General Systems Sector |
Cellular Infrastructure Group         | Internet:  yorton@rtsg.mot.com
Arlington Heights, IL  60004          | X.400:     James_Yorton-QA1010@email
Xref: sparky comp.unix.shell:5102 comp.lang.perl:7497
From: 873clifton@gw.wmich.edu
Newsgroups: comp.unix.shell,comp.lang.perl
Subject: Universal Archive Wrapper?
Date: 17 Dec 92 15:48:39 EST
Organization: Western Michigan University

Hello netters.

I spend alot of time working with file archives of different types (zip,zoo,
lzh,arj,etc.). Now I thought a good idea would be to write a shell or perl
script to give me a universal interface to all these types, relieving me
of the need to remember the syntax of each. This `universal archive wrapper'
would take the following arguments:

	> uaw [option] archivefile [file...]

where [option] would be one of a standard set:

	-d	delete file in archive
	-l	list the contents of the archive
	-a	add file to archive
	-m	move file into archive
	-p	print file in archive to stdout

	...

Now before working on this wrapper and in the spirit of avoinding reinvention
of the wheel, I was wondering whether anyone as already tackled this problem.

Thanks, followup if sufficient interest, else Email to:

	99clifto@lab.cc.wmich.edu

/Doug
Newsgroups: comp.unix.shell
From: snark@chiasmus.engin.umich.edu (Mark Van Antwerp)
Subject: Re: Reading a line from a file in Bourne
Date: Fri, 11 Dec 92 18:59:01 EST
Organization: University of Michigan (CAEN)
Distribution: usa
Originator: snark@chiasmus.engin.umich.edu


Scott K. Hutton wrote:
-------------------------
  for ITEM in `cat $FILENAME`
       do echo a full line: $ITEM
     done

   If you're given a file that contains:

     Line one
     Line two

   This script would output

     a full line: Line
     a full line: one
     a full line: Line
     a full line: two

   Any easy answers?
------------------------

Well, the reason it does that is do to the IFS in the bourne
shell.  You can change the IFS or use another command.

To change IFS, do:

IFS="
"
    This changes it to a newline.

Some other ideas are using read or awk.

        -snark

p.s.  I think IFS defaults to a space and/or tab.
Newsgroups: comp.unix.shell
From: barr@pop.psu.edu (David Barr)
Subject: Re: Reading a line from a file in Bourne
Organization: Penn State Population Research Institute
Distribution: usa
Date: Sat, 12 Dec 92 00:23:37 GMT

In article <SHUTTON.92Dec11112920@fokker.union.indiana.edu> shutton@fokker.union.indiana.edu (Scott K. Hutton) writes:
>This is something that has eluded me  for a good while, but now I have
>to find out.  How can  you read lines (yes, entire lines) sequentially
>in from a file and store them in a variable.

Well, if you read the man page to sh, you would have found 
(something like) this:

     read [ name ... ]
                    One line is read from the standard input and,
                    using the internal field separator, IFS (nor-
                    mally a SPACE or TAB character),  to  delimit
                    word  boundaries,  the first word is assigned
                    to the first name, the  second  word  to  the
                    second   name,   etc.,  with  leftover  words
                    assigned to the last name.  Lines can be con-
                    tinued using \NEWLINE.  Characters other than
                    NEWLINE can be quoted by preceding them  with
                    a  backslash.   These backslashes are removed
                    before words are assigned to  names,  and  no
                    interpretation  is done on the character that
                    follows the backslash.  The return code is  0
                    unless an EOF is encountered.
-------

If you want to read a specific file instead of standard input,
do something like this:

#!/bin/sh
exec </etc/resolv.conf
read foo domain
read foo nameserver
echo your domain is $domain
echo this machine\'s first nameserver is $nameserver

--Dave
-- 
System Administrator, Population Research Institute    barr@pop.psu.edu
#define ENOTTY          25              /* Not a typewriter */
Newsgroups: comp.unix.shell
From: ralf.weber@fernuni-hagen.de (Ralf Weber)
Subject: Question concerning Xterm control sequences 
Organization: FernUniversitaet Hagen
Date: Tue, 15 Dec 1992 08:48:13 GMT

Hello world,

is there anybody who can give me information on how i can get
the Xterm control sequences ?

Who has experience in Tektronix 40xx terminal emulation programming
with Xterm ?

Many thanks in advance...

*****************************************************************************
Ralf Weber                                            FernUniversitaet Hagen
                                                        Nachrichtentechnik
Tel..: ++49 2331/987-4358                              Elberfelder  Str. 95
FAX..: ++49 2331/332904                                    5800 Hagen
email: ralf.weber@fernuni-hagen.de                           Germany
****************************************************************************                                                             




Newsgroups: comp.unix.shell
From: ralf.weber@fernuni-hagen.de (Ralf Weber)
Subject: Question concerning Xterm control sequences 
Organization: FernUniversitaet Hagen
Date: Tue, 15 Dec 1992 08:34:06 GMT

Hello world,

is there anybody who can give me information on how i can get
the Xterm control sequences ?

Who has experience in Tektronix 40xx terminal emulation programming
with Xterm ?

Many thanks in advance...

*****************************************************************************
Ralf Weber                                            FernUniversitaet Hagen
                                                        Nachrichtentechnik
Tel..: ++49 2331/987-4358                              Elberfelder  Str. 95
FAX..: ++49 2331/332904                                    5800 Hagen
email: ralf.weber@fernuni-hagen.de                           Germany
****************************************************************************                                                             



Newsgroups: comp.unix.shell
From: ray@Celestial.COM (Ray Jones)
Subject: Re: Communicating with background processes
Organization: Celestial Software, Mercer Island, WA
Date: Sat, 12 Dec 1992 01:22:40 GMT

In <richard.723718447@dutepp6> Richard.Kooijman@dnpap.et.tudelft.nl (Richard Kooijman) writes:

>Is it possible to communicate with background processes in sh, csh or ksh?

>This is what I would like to do: start up a program in the background
>that reads and writes to standard in and out, communicate with
>this program through some other file descriptors.
[stuff deleted]
>I want to use the program spook as a kind of daemon. I now know that the
>above program simply can't work, but I placed it here to illustrate what
>I want.

I have not tried it with file descriptors, but have used an ordinary file
for this purpose.  I have a program that continues to run (ringing the bell)
until a file (/tmp/x) content changes from one value to another.
Crude, but it works.
-- 
INTERNET:  ray@Celestial.COM   Ray A. Jones; Celestial Software
UUCP:   ...!thebes!camco!ray   6641 East Mercer Way
             uunet!camco!ray   Mercer Island, WA 98040; (206) 947-5591
The probability of one or more spelling errors in this missive approaches
Newsgroups: comp.unix.shell
From: sasmob@chewy.unx.sas.com (Mark Burhans)
Subject: Re: crontab/script to capture reference to user?
Originator: sasmob@chewy.unx.sas.com
Date: Thu, 17 Dec 1992 00:22:06 GMT
Distribution: usa
Organization: SAS Institute Inc.


In article <1g9tkdINNdc2@agate.berkeley.edu>, stevena@triangle.Berkeley.EDU (Steven Alexander) writes:
|> Can references to one's  userid in others' command lines be captured
|> and notice sent to the userid?  I have tried the following, which
|> didn't work:
|> 
|> ============
|> |MY CRONTAB|
|> ============
|> 00,05,10,15,20,25,30,35,40,45,50,55 * * * * sh < [SCRIPT]
|> 
|> ============
|> |  SCRIPT  |
|> ============
|> #!sh
|> ps -au >! [WORKFILE]
|> if grep stevena [WORKFILE] > /dev/null
|> then
|>      mail stevena < [WORKFILE]
|> fi
|> 
|> 
|> Any solutions or hints would be welcome.

Heheheheh!  You seem kinda paranoid!  :-)
Ok, I don't know what this line:
       ps -au >! [WORKFILE]
is supposed to be doing, but I'll assume you are looking for processes
on -auxillaries (ie other nodes) and sending that output to a temp file.
Don't know what ">!" does.

Anyway, I'd try it this way:

-----cut here-----
#!/bin/sh

ps -aux | grep stevena | grep -v grep > $WORKFILE
if [ -s $WORKFILE ]; then
  mail stevena < $WORKFILE
fi
-----cut here-----

Every 5 minutes?  Every day?  Are you on Clinton's staff?
-- 
---Mark C. Burhans---sasmob@chewy.unx.sas.com---919/677-8001 ext 7324
SAS Institute, Inc., USA, SAS Campus Drive, Cary, NC 27513.
"Polygamy:  One wife too many.  Monogamy:  Same idea."  --Unknown???
Newsgroups: comp.unix.shell
From: esaffle@gmuvax2.gmu.edu (Ed Saffle)
Subject: Re: .cshrc vs .login in csh
Organization: George Mason University, Fairfax, Va.
Date: Tue, 15 Dec 1992 14:42:02 GMT

  Sorry to add so late to this conversation, but isn't the .login file
only used at login time, and the .cshrc file used everytime a new shell is
started ( unless -f is specified)?
  So why not put your environment setup stuff in the .login, such as path and
terminal stuff, then put aliases and that kind of thing in the .cshrc?

Ed
From: popaul@cs.mcgill.ca (Paul TERRAY)
Newsgroups: comp.unix.shell
Subject: Re: Novice Unix user help
Date: 16 Dec 92 17:59:13 GMT
Reply-To: popaul@binkley.cs.mcgill.ca
Organization: SOCS, McGill University, Montreal, Canada

In article <101787@netnews.upenn.edu> ericj@eniac.seas.upenn.edu (Eric J  
Reiter) writes:
> Can anyone tell me how I can change my prompt to display what directory I am 
> in; i.e. like DOS set prompt=$p$g ?
As you have tcsh (thanks to finger :) ) you have to patch your cd command with
an alias in your .cshrc (or put all your alias in a .alias file and put a 
"source .alias" in your .cshrc). The alias look like :
alias cd        'cd \!*;  set prompt="[`hostname`][$cwd] "'

That will do it. Next time, say what shell you're using so I will not need to
do a finger... (BTW, beautiful .plan)

Pauly prompt to display what directory I am 
> in; i.e. like DOS set prompt=$p$g ?
As you have tcsh (thanks to finger :) ) you have to patch your cd command with
an alias in your .cshrc (or put all your alias in a .alias file and put a 
"source .alias" in your .cshrc). The alias look like :
alias cd        'cd \!*;  set prompt="[`hostname`][$cwd] "'

That will do it. Next time, say what shell you're using so I will 
Newsgroups: comp.unix.shell,comp.unix.questions,comp.unix.admin
From: stevez@cbnewsb.cb.att.com (steven.a.zubatkin)
Subject: Re: crontab problem executing this command!
Organization: AT&T
Date: Mon, 14 Dec 1992 16:59:15 GMT

From article <EJH.92Dec10164940@khonshu.colorado.edu>, by ejh@khonshu.colorado.edu (Edward J. Hartnett):
> 
> Hi! I have a command in a crontab file which is supposed to
> periodically copy a mail file (containing my outgoing mail) into a
> datestamped file. Here's what I see when I type crontab -e
> 
> 59 11 * * 6 cp /home/khonshu/sjsk/.outgoing.record /home/khonshu/sjsk/msgs/mailout.`date '+%y%m%d'`
> 
> Which I expected to copy my .outgoing.record to mailout.921205 last
> Saturday morning. But instead I got a copy to mailout. with no date.
> Can anyone tell me what I'm doing wrong?
> --
> 	Don't blame me, I voted against Amendment 2!
> 
> Edward Hartnett				ejh@khonshu.colorado.edu
> 

Don't know for sure, but you do need to escape the percents (%), just
look at the man page (if you have access to it) for cron.

Steve Zubatkin
Morristown, NJ

Newsgroups: comp.unix.shell
From: vijay@ncsa.uiuc.edu (Vijay Rangarajan)
Subject: Re: finger w/ .plan?
Originator: vijay@picard.ncsa.uiuc.edu
Organization: Nat'l Ctr for Supercomp App (NCSA) @ University of Illinois
Date: Tue, 15 Dec 1992 19:26:33 GMT

In article <102149@netnews.upenn.edu> ericj@foxtrot.seas.upenn.edu (Eric J Reiter) writes:
>
>How copme when I finger from another sight,  I dont get the .plan ?
>is there a way to change this?

Check permissions on your home directory and the permissions on .plan -