HDTenEightyP/NetNews huggingface dataset:
From: borrel@dhhalden.no (Borre Ludvigsen)
Newsgroups: comp.unix.shell,comp.unix.programmer,alt.binaries.pictures.d,sci.space
Subject: Re: Automated mail > file cat & decoding ?
Date: 6 Oct 92 13:45:39 GMT
Reply-To: borrel@dhhalden.no (Borre Ludvigsen)
Organization: Ostfold College

In article <1992Oct5.095452.24605@dhhalden.no> borrel@dhhalden.no (Borre Ludvigsen)  
writes:
> Automated mail > file cat & decoding ?
> 
> We need a shell script, program, gizmo that reads a mail spool file, recognizes a  
> ............
> convert and sluice it to the right directory of anonymous ftp account.
> 
> If anyone has any tips, scripts or code that they think might help, we'd be  
> etarnally grateful.
> 
> 
> Kjell Are Refsvik <kjellr@dhhalden.no>
> &
> Barre Ludvigsen <borrel@dhhalden.no>

Repsonders to our question about Automated mail > file cat & decoding,

Thank you _all_ for your help and interest. We have downloaded some of the suggested  
solutions which Kjell Are is looking at now.

In spite of my ignorance about crossposting (actually laziness - last time I tried  
it with my newsreader, it didn't work) for which I humbly apologize to those for  
whom it may have caused havoc, irritation or anxiety - (Kjell Are did mutter  
something about it under his breath as he saw what I was doing) - we are very  
grateful for all the help we have received so far.

The answers below are only a resume of the suggestions received. A complete text  
file of the replies may be found on our anonymous ftp server <ftp.dhhalden.no>  
(158.36.33.11) in the directory /pub/mail.

- Barre Ludvigsen

-----------------------------------------------------------------
Barre Ludvigsen                                borrel@dhhalden.no
Associate Professor, Architect        borrel@sigallah.dhhalden.no
Ostfold Regional College                    bludvigs@ulrik.uio.no
Department of Computer Science          73277.3443@Compuserve.com
Os Alle 9                                             ***********
N-1750 HALDEN, Norway                                 NeXTMail OK
-----------------------------------------------------------------
 phone479185400/fax479185485/home479341922/direct479185577ext219
-----------------------------------------------------------------
From: dhami@cs.ubc.ca (Mandeep S Dhami)
Newsgroups: comp.unix.shell
Subject: Re: Rlogin with shell (ksh)
Date: 6 Oct 1992 01:34:20 -0700
Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
NNTP-Posting-Host: valhalla.cs.ubc.ca

trw@unixland.natick.ma.us (Tim Weil) writes:

>Can rlogin be  performed in Korn Shelll script language
> including response to the password prompt?  So far, we
> are limited to using the .rhosts file which allows users
> without passwords to login.
> 
> Thanks in advance

> Timothy.Weil@dialcom.tymnet.com

I would use:
1. perl with caht2.pl OR
2. expect

In either case, I get a pty controlling the rlogin process which I
can control the input to. I am not sure if you could do it with (*)sh
alone.

Mandeep.
__________________________________________________________________
"I'm very brave generally," he went on in a low voice:
"only to-day I happen to have a headache."
                                      -- Lewis Carroll
__________________________________________________________________
Newsgroups: comp.unix.shell
From: mju@mudos.ann-arbor.mi.us (Marc Unangst)
Subject: Re: #!/bin/sh | #!/bin/ksh ...
Date: Thu, 1 Oct 1992 02:07:03 GMT
Organization: The Programmer's Pit Stop, Ann Arbor MI

In article <1992Sep30.223451.5448@wam.umd.edu> dinguyen@wam.umd.edu (Dzi Nguyen) writes:
>about it that is most shell script at the top of the files they always have
>this line:
[hash-bang examples deleted]

"#!" is a magic cookie for the OS's exec(2) system call that says,
"This file is a script to be interpreted, not a native a.out or COFF
or ELF format file; pass it to the interpreter named immediately after
the magic cookie."  So, "#!/bin/sh" means that the file is a script to
be interpreted by the /bin/sh interpreter, otherwise known as the
Bourne shell.  "#!/bin/ksh" is similar, but for the Korn shell.  Note
that not all systems support this functionality -- I believe most of
the later versions of BSD have it, but System V and SysV-derived OSes
before SVR4 do not have it.

":" is what you used to get sort of the same functionality on a system
that didn't have support for the "#!" magic cookie (i.e., a SVR3
system).  ":" is the archaic comment character for the Bourne shell,
but also tells the C shell to execute the script with the Bourne shell
instead.  So, if you are using the Bourne shell, the ":" will be
ignored as a comment.  But if you are using the C shell, it will
notice the ":" at the beginning of the file, and exec the Bourne shell
to interpret the script.  This is significantly less flexible than the
"#!" functionality described above, but has the advantage of not
requiring libc modifications (which would involve relinking every
binary on the system built from C source).

Note that both ":" and "#!" must be the first characters in the file
to be effective.

-- 
Marc Unangst, N8VRH         | "There are two ways to solve this problem:
mju@mudos.ann-arbor.mi.us   | the hard way, and the easy way.  Let's start
                            | with the hard way."
                            |   - W. Scheider, from a Physics lecture
Newsgroups: comp.unix.shell
From: pdel@ADS.COM (Peter Delevoryas)
Subject: noidle script (expect) doesn't work for me
Organization: Advanced Decision Systems, Mtn. View, CA (415)960-7300
Distribution: usa
Date: Wed, 30 Sep 1992 06:54:28 GMT

Well, it works but my terminal still logs me out:


The process is running:

bert(33)-> ps aux| grep expect
pdel      6228  0.4  1.3  140  188 p5 S    13:10   0:01 /bin/expect /afs/ads.com

Here is what it did:

bert(34)-> date
Tue Sep 29 13:25:45 PDT 1992
bert(35)-> date
Tue Sep 29 13:35:46 PDT 1992
bert(36)->
[Connection to BERT idle too long; timed out]


The Script: (sends a 'date' command every ten minutes)

#!/bin/expect  
#Name: noidle
#Description: expect script to run a shell which avoids being
"autologged out"
#        by sending a <space><delete> every hour if no other I/O has
occurred.
#Author: Don Libes, December 30, 1991

set timeout 600
log_user 0
system stty -echo raw
spawn $env(SHELL)
expect  {
        timeout {send "date\n"; continue -expect}
        -re .+ {send_user $expect_out(buffer); continue -expect}
        -i $user_spawn_id -re .+ {send $expect_out(buffer); continue
-expect}
}
system stty echo -raw





So it looks like this script DOES NOT simulate a keyboard press; it
just sends some characters or whatever to the tty. Is that right? Wah.

Well, I'm back to using Quickeys macros (on my Mac). :(


No worry, I had fun compiling tcl and expect; actually couldn't get it
going within our afs-filesystem. Had to put it out on NFS.

PD
--

 login name:   L1-A                      
 In real life: Peter Delevoryas
 In any other life: a cheap imitation
Newsgroups: comp.unix.shell
From: ashish@eng.umd.edu (Ashish Nedungadi)
Subject: Read variable from stdin
Date: Sat, 03 Oct 92 21:51:43 GMT
Organization: College of Engineering, University of Maryland, College Park
Originator: ashish@valkyrie.eng.umd.edu


Hi Shell_Script Gurus,
	I am a novice at shell scripting and would like some information 
from those of you who are pretty good at this stuff.
	I want to periodically cp a file from the present working directory
to another dir. and then change the permission of that file in the new dir.
So far I have the following script I call cp2pub :

>#!/bin/csh -f
>echo -n "Enter file name to be copied to public folder : "
>set file=$<
>cp $file <new_dir>/.
>chmod g+r <new_dir>/$file

This is OK  but I always have to input the filename.  I would like to enter the
filename after the cp2pub command.  Like
	
	cp2pub <filename>

Much the same way you issue the command 

	cp <filename1> <filename2>

Your input to this query will be most appreciated.  You can send me 
info by e-mail.  Thanks!!

Note: Our system here uses the C-Shell

Ashish Nedungadi
Dept. of Aerospace Engineering
University  of Engineering
Newsgroups: comp.unix.shell
From: root@trebor.uucp (Bob Stockler)
Subject: Re: #!/bin/sh | #!/bin/ksh ...
Organization: Bob Stockler
Date: Sat, 03 Oct 1992 23:33:23 GMT

>":" is what you used to get sort of the same functionality on a system
>that didn't have support for the "#!" magic cookie (i.e., a SVR3
>system).  ":" is the archaic comment character for the Bourne shell,
>but also tells the C shell to execute the script with the Bourne shell
>instead.  So, if you are using the Bourne shell, the ":" will be
>ignored as a comment.  But if you are using the C shell, it will
>notice the ":" at the beginning of the file, and exec the Bourne shell
>to interpret the script.

My understanding is that the C shell calls the Bourne shell to read and
execute lines of an executable shell script *unless* the first character
of the file is a sharp ("#").  Starting a shell script with a colon is
a convention that many adopt to prevent a "#" from accidently becoming
the first character of a script file, which could easily occur if one
wanted a remarked line (beginning with a "#") at (or near) the head of
a file.  A blank line might easily be removed; the colon (a shell no-op,
that does nothing, and does it well [always returning TRUE]) is a good
place (space) holder.
From: ce202a2@prism.gatech.EDU (Peter L. Thomas, AE)
Newsgroups: comp.unix.shell,git.oit.questions
Subject: How to mail to multiple users (i.e. a mailing list)
Date: 28 Sep 92 16:31:33 GMT
Followup-To: comp.unix.shell
Organization: Georgia Institute of Technology

Some of the following are more elegant than others, but they all
seem like they will work.  I'll probably just use the suggestion
made by the first three respondents below,  since it is the
simplest mod, but I thought I'd summarize other's suggestions
for those of you who have different styles.

--------
From: chupchup@piggy.ucsb.edu (Robert Earl)
From: dattier@ddsw1.mcs.com (David Tamkin)
From: ianh@nmpd.oz.au (Ian Holland)

while read name
do
    mail -s "MESSAGE" $name <message.file
done < sae.addresses

--------
From: chupchup@piggy.ucsb.edu (Robert Earl)

or you could just use the aliases(5) file for sendmail...

--------
From: dattier@ddsw1.mcs.com (David Tamkin)

If the names include parenthetical real names, "$name" rather
than just $name might help in the mail command.

--------
Caveat:  The following expects usernames only, no real names.
From: gt2807a@prism.gatech.edu (Benjamin H. Cowan)

for i in `cat maillist`
do
 mail -s subject $i < send
 echo $i "done"
 sleep 3
done

  This will take all the names in the file "maillist" and send
them mail individually, each with the subject specified.  The
body of the letter is the contents of the file "send".

  The sleep statement is just a precaution to make sure the
machines isn't overly taxed by processing so many mail
requests at once.  The echo statement can be removed if no
output is desired.

--------
From: ccoprdg@prism.gatech.edu (Drew Gonczi)

I'd try something like:

	for user in `cat user.file | awk '{print $1}'`
	do
		mail -s 'sjaf;skdj' $user <message.file
	done

This would assume that the email address was the first column
entry in the users file.   Substitute {print $NF} if it is the
last entry.

the $NF would handle

	Fred Jones     fred@nowhere.important
	John Q. Public     johnq@world.com
	Dr.  WE. R. Pompous IV   ego@stock.market.com


---------
From: ronnya@stud.cs.uit.no (Ronny Haavard Arild)

You could try this instead:

	IFS=  # To make sure you read complete lines...
	exec 4< sae.addressed  # open file for reading, using fd 4
	while read -u4 name ; do ;\
	mail -s "MESSAGE" $name < message.file ; done
	exec 4<&-  # close fd 4

This will open the file sae.addressed for reading and will read
all lines until EOF. The reason I use "4" as file descriptor is
just because I'm used to it (I tend to use "3" for writing...).
You can of course use any number you like (that is, up to
twenty, I think...).

--------
From: harold@cc.gatech.edu (Harold C. Forbes)

why can't you just use a mailing list?

in your .mailrc:
alias mail_list person1@prism person2@prism person3@prism ...

then "mail mail_list" will send the same message to 
everyone in the list.
-- 
Peter L. Thomas (Senior AE)
"Figures never lie, but liars always figure."
Georgia Institute of Technology, Atlanta Georgia, 30332
Internet: ce202a2@prism.gatech.edu
Xref: sparky comp.unix.shell:4166 comp.unix.questions:11608
From: agc@bmdhh298.bnr.ca (Alan Carter)
Newsgroups: comp.unix.shell,comp.unix.questions
Subject: Re: Help with sysv bourne expr command
Date: 30 Sep 92 11:40:51 GMT
Organization: BNR-Europe-Limited, Maidenhead, England

In article <5613@dsacg3.dsac.dla.mil>, nrs2495 (Bill Reed ) writes:
|> What I am trying to do here is get a total count in megabytes, that these 
|> certain filesystems take up.  Everything works fine, except for the "expr"
|> line.  I just can't get it to add the cut material.  Does anyone see what
|> I am doing wrong?  Or with bourne shell, is there another way of doing this?
|> FSTOTAL=0
|> dfspace2 > /tmp/dfspace2
|> 
|> for FSYSTEMS in /rb /rm /usr2 /pcnfs /usr /r /rs /rr /inx / /ieps   
|> do
|>    # get the megabyte count from each filesystem 
|>    FSONE=`cat /tmp/dfspace2|fgrep $FSYSTEMS' '|cut -c14-19`
|>    # total the count up
|>    FSTOTAL=`expr $FSONE + $FSTOTAL`  # syntax error 
|> done
|> echo $FSTOTAL
|> 
|> here is a line from /tmp/dfspace2, spacing is not correct:
|> 
|> /           :         11.68 MB  of   26.45 MB available  (44.15%).

Bit hard to see what the positionally delimitered fields are doing if
the spacing is not correct, but you might look at what you are adding up -
expr(1) will only accept integer arguments.

   Alan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Maidenhead itself is too snobby to be pleasant. It is the haunt of the
   river swell and his overdressed female companion. It is the town of showy
   hotels, patronized chiefly by dudes and ballet girls. 

   Three Men In A Boat, Jerome K. Jerome, 1889
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Newsgroups: comp.unix.shell
From: bzs@ussr.std.com (Barry Shein)
Subject: Re: Locking out users
Followup-To: comp.unix.shell
Organization: The World
	<1992Sep26.182041.15873@husc3.harvard.edu>
	<BZS.92Sep26222930@ussr.std.com> <1404@pacsoft.com>
Date: Wed, 30 Sep 1992 03:29:21 GMT


>>I don't know why you think this is easier than, eg, just putting
>>a * in front of the person's passwd encryption and/or the message.
>
>For systems with "enhanced security", this too can be abused by a malicious
>person. The individual can continue to attempt to login, and fail.  After
>a number of attempts, the port is disabled. This is done for each dialup line,
>no legitimate user can login and the admin ends up getting paged during the
>weekend because none of the dialup ports "work".

yup, sure sounds enhanced to me...

--
        -Barry Shein

Software Tool & Die    | bzs@world.std.com          | uunet!world!bzs
Purveyors to the Trade | Voice: 617-739-0202        | Login: 617-739-WRLD
Newsgroups: comp.unix.shell,comp.unix.admin,comp.unix.wizards
From: bzs@ussr.std.com (Barry Shein)
Subject: Re: Locking out users
Organization: The World
	<1992Sep17.160002.18542@mintaka.lcs.mit.edu>
	<27634.Sep2003.29.4092@virtualnews.nyu.edu>
	<1992Sep26.182041.15873@husc3.harvard.edu>
Date: Sun, 27 Sep 1992 03:29:30 GMT


From: haley@husc10.harvard.edu (Elizabeth Haley)
>If you must lock-out a user without removing their directories,
>eliminate all the system holes, which you should anyway, then change
>the users shell to /bin/sync... that way they'll be doing you a minor
>favor.

Errr, bad idea.

On large servers a sync can pause the entire system for a few seconds,
it's not always a "favor", and may even give a malicious user a way to
harass you by causing the system to sync repeatedly.

>But all in all it seems easier to remove their directory to
>some tar device, can the passwd line, and send them snail-mail to say
>yer mad at them, or some script that prints this on the screen when
>they try a log on...

Seems like you're setting yourself up for a lot of work if it was just
some misunderstanding (like if the trouble was caused by someone
getting into an honest user's account and all that's really needed is
a change of password or something.) I don't know why you think this is
easier than, eg, just putting a * in front of the person's passwd
encryption and/or the message.

--
        -Barry Shein

Software Tool & Die    | bzs@world.std.com          | uunet!world!bzs
Purveyors to the Trade | Voice: 617-739-0202        | Login: 617-739-WRLD
From: peter@auad.acadiau.ca (Peter Steele)
Newsgroups: comp.unix.shell
Subject: ksh source
Date: 7 Oct 92 00:43:37 GMT
Organization: Acadia University

Where's the best place to pick up the latest PD ksh? Archie lists
several things with various dates and I want to make sure what I
get is something current.
--
Peter Steele        Unix Services Manager            peter.steele@acadiau.ca 
Acadia Univ., Wolfville, NS, Canada B0P 1X0  902-542-2201  Fax: 902-542-4364
Newsgroups: comp.unix.shell
From: root@trebor.uucp (Bob Stockler)
Subject: Re: ksh, pipes, co-processes and stdout
Organization: Bob Stockler
Date: Sat, 03 Oct 1992 23:41:25 GMT

bih@mowgli.East.Sun.COM (Bennet Ih - Sun BOS Hardware - Sunergy) writes:

>Hi... I have a ksh script that starts another program as a co-process using the
>|& operator. Does anyone know of a way to prevent the co-process' stdout
>from being redirected back into ksh? Right now I'm using:

I'm not sure exactly what your script is trying to do, but wouldn't the pipe
symbol ("|") alone do what you need?

As I understand it, the utility of the "|?" is to open a two-way pipe between
a script and another program.  You can read a line from the external program
with "read -p", or write a line to it with "print -p".  For instance, you can
execute "bc |$", and then send commands to "bc" and read back its answers,
without having to execute "bc" but once.  That's one application I've made of
it, anyway.

Newsgroups: comp.unix.shell
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: how to skip last line in awk?
Originator: tchrist@pixel.convex.com
Date: Wed, 30 Sep 1992 18:47:04 GMT
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: Convex Computer Corporation, Colorado Springs, CO
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

From the keyboard of holger@is.morgan.com (Holger Veith):
:Hi,
:
:to simplify: lets say I have a column of number in ascii format.  I would like
:to subtract one from every number except on the last line.
:
:The actual problem is more difficult but basically I need to test if I am
:on the last line and NOT do something.

What?  No eof() function in awk??  Seems to work in my a2p'd version. :-)

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist

	    "AT&T -- anything better is illegal."
		  -- Keith Lofstrom, comp.unix.bsd, "AT&T sues BSDI" thread
From: ankit@informix.com (Ankit Monga)
Newsgroups: comp.unix.shell
Subject: Re: grep segmentation fault
Date: 30 Sep 92 23:16:01 GMT
Organization: Informix Software, Inc.

wongm@latcs4.lat.oz.au (M.C. Wong) writes:

>Hi,
>  I got some interesting results testing grep with some simple regular
>  expression. Can anyone tell what goes wrong ?

>  Given the following simple test file,


>1221
>1212
>xyyx
>lisxxlis
>lisxlisx
>xlislisx
>lisxxlisxxlis
>first second first third
>first first first
>first second first third first
>first second third third 


>    I tried the following :

>    Case A
>    ------
>        - wth grep '\(x\)\{1\}' test,
>	      grep '\(x\)\{1,1\}' test,
>	      grep '\(x\)\{1,3\}' test,
>	      grep '\(x\)\{1,6\}' test,
>	      grep '\(x\)\{1,8\}' test,
>	      grep '\(x\)\{1,9\}' test,
>	      grep '\(x\)\{1,10\}' test,

>           I go the following :

>	   xyyx
>	   lisxxlis
>	   lisxlisx
>	   xlislisx
>	   lisxxlisxxlis

>        - with grep '\(x\)\{1,4\}' test      
>	  no result!

>        - with grep '\(x\)\{1,2\}' test
>	       grep '\(x\)\{1,5\}' test
>	       grep '\(x\)\{1,7\}' test

>          I got segementation fault !! Yes segmentation fault !!

>    
>    Case B
>    ------
>      - with grep 'x\{1\}' test
>	     .
>	     .
>	     .
>	     .
>	     etc

>        I got the results b4!


>  My question is that what causes the segmentation fault? Since I am not 
>  expert in shell and regular expression stuff, I guess it ha got to do
>  with the way grep evaluate the expression, is that right ?



>  Replies in any form welcomed, including email. Many thanks in advance !


>  - wongm@latcs1.lat.oz.au

I think {n , n} construct of System V grep is not implemented in your system.
Check MAN pages. Otherwise .... its a BUG.



-ankit 					...use the header to find the path
Newsgroups: comp.unix.shell,comp.unix.programmer
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: how to set parent's environment variables from shell script?
Originator: tchrist@pixel.convex.com
Date: Fri, 2 Oct 1992 13:43:13 GMT
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: Convex Computer Corporation, Colorado Springs, CO
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

From the keyboard of cogen@ll.mit.edu (David Cogen):
:So, can anyone suggest a third solution, or a way to overcome the deficiencies
:of my two inadequate solutions above? Please help!

Rewrite the kernel.

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist

	    "AT&T -- anything better is illegal."
		  -- Keith Lofstrom, comp.unix.bsd, "AT&T sues BSDI" thread
Xref: sparky comp.unix.shell:4140 comp.unix.admin:5242 comp.unix.wizards:4087
From: libes@cme.nist.gov (Don Libes)
Newsgroups: comp.unix.shell
Subject: Re: control-Z in test file
Date: 29 Sep 92 17:09:40 GMT
Organization: National Institute of Standards and Technology

In article <22614@optima.cs.arizona.edu> hong@cs.arizona.edu (Ke George Hong) writes:
}I wrote a shell with csh-like syntax and try to write some test
}cases. As this shell is an interactive program, how do I write the
}test case that can include ^Z ?

}  For example:
}  myshell%sleep 100
}  ^Z
}  [1] stopped
}  myshell%

}  How to do this in a file so that I can test it automatically?

This very example of testing the shell, sleep, and ^Z was described in
the paper "Regression Testing and Conformance Testing Interactive
Programs" which appeared in the Summer 1992 USENIX Conference
Proceedings.
Xref: sparky comp.unix.shell:4181 comp.unix.programmer:4846