HDTenEightyP/NetNews huggingface dataset:
From: cjross@bbn.com (chris ross)
Newsgroups: comp.unix.shell
Subject: Re: clever `cat' commmand?
Date: 14 Sep 92 17:53:04 GMT
NNTP-Posting-Host: bbn.com

Harald.Eikrem@delab.sintef.no writes:

>For once, a question.  Can anyone think of the simplest means of making
>a utility that behaves like `cat(1)', but exits with 0 if something went
>through it, otherwise 1?  Preferrably a one-liner......

>I've tried:   awk '{ s=1; print; }; END{ if(s) exit 0; exit 1; }'

>which is ok with a line oriented input stream, but not with a "binary" 
>stream.

Your grep may be able to accomplish this.
Use grep -s if you don't want the output.

  $ echo foo | grep .
  foo
  $ echo $?
  0
  $ cat </dev/null | grep .
  $ echo $?
  1

If not, try this in place of the grep command, with
appropriate mods if you're using csh.  Use "cat >" instead
of "tee" if you don't want the output.

  (cd /tmp; tee $$; test -s $$; S=$?; rm $$; exit $S)

Or, if you're paranoid about cleaning up if signalled:

  (cd /tmp; tee $$; trap 'rm $$; exit $S' 0 1 2 3 13 15; test -s $$; S=$?)

(You _did_ ask for a one-liner :-)
Here are perl solutions, with and without output:

  perl -e '$x = 1, print while <STDIN>; exit !$x'
  perl -e 'exit !<STDIN>'


chris ross   <cjross@bbn.com>   BBN Advanced Simulations   (617) 873-3272
 WARNING: article may contain flammable material.  Do not expose to open
   flames.  In case of accidental ignition, douse keyboard with water.
From: micah@hardy.u.washington.edu (Micah Anderson)
Newsgroups: comp.unix.shell
Subject: Re: Could someone help me with script?
Date: 5 Sep 92 08:09:46 GMT
Organization: University of Washington

>In article <1992Sep3.151142.27136@u.washington.edu>,
>micah@hardy.u.washington.edu (Micah Anderson) says:
>>
>>I run the They Might Be Giants mailing list which has over 260 users on
>>it, I am trying to make it much easier for me to subscribe and unsubscibe

Thanks to all who sent me some help... now for the unsubscription part...
is there a flag in uniq that will remove BOTH addresses if there are
two duplicate lines? If there is (I can't find one in the man pages) then
I can simply go cat unsub >> /com/mailer/TMBG/USERS and then uniq out
BOTH addresses (after a sort)... or should I go about this another way?

Thanks again everyone!
Newsgroups: comp.unix.shell
From: subbarao@tex.Princeton.EDU (Kartik Subbarao)
Subject: Re: Simulating keyboard input in interactive programs
Organization: Princeton University
Date: Sat, 12 Sep 1992 23:24:24 GMT

In article <BuHGrv.8yD@mentor.cc.purdue.edu> ahern@sage.cc.purdue.edu (Sean Ahern) writes:

>subbarao@tex.Princeton.EDU wrote:
>>Redirecting the output of echo to your tty simply writes the text 'ls' on
>>your terminal. Just as if you said "echo thousandlineslong" > `tty`. It
>>does NOT write to the input buffer of the tty. To do so, you can use the 
>>TIOCSTI ioctl if you have it.
>
>Using the command echo `ls` > `tty` might work, but again, does not solve
>the basic problem that was addressed.

Huh?? How `might' echoing the string "News bin files ftp lost+found mail"
work, and how is it any different from echoing the string "ls" to your
terminal?

	Once again, a plea for people to *TEST* their solutions before posting
them falls on deaf ears.

	-Kartik
Newsgroups: comp.unix.shell
From: ellis@nova.gmi.edu (Stew Ellis)
Subject: Re: Automating telnet
Keywords: telnet, here documents, automatic login
Organization: GMI Engineering&Management Institute, Flint, MI
Date: Wed, 9 Sep 1992 08:18:43 GMT

ellis@nova.gmi.edu (Stew Ellis) (that's me) writes:

>I am trying to write a shell script to login to a remote gopher program.
>The gopher program runs at login for user gopher, with no passwd.

>I have seen scripts before that automated ftp or telnet login, but I cannot
>find them.

>I would have thought that telnet would read a here document in an orderly
>fashion so something like the following would work:
>  telnet remote.host << EOF
>  loginname
>  EOF

>The man page for telnet is of no help on this.  I am probably missing
>something obvious to someone, but it is not obvious to me. :(

>Thank you for any help.


[dup sig del]

A number of people wrote suggesting that I use expect.  I had already
fetched expect for some other project in the past and had decided not to use
it for that project because it also meant I would have to install tcl, which
I am too busy to contemplate now.

Tom Chistians{e|o}n DID NOT write to suggest perl, which would probably have
worked.

One kind soul pointed out that he thought here documents explicitly violated
some of the RFC's for telnet, but that rlogin was less restrictive.  I have
solved my problem with the following script (is this a one-liner or a
two-liner), that logs me into the gopher client on the remote host.  I did
not need any negotiation, so a here doc was not tried.


#!/bin/sh

rlogin -l gopher remote.gopher.host


Thank you to everyone, even if only one of you gave me the simplest
solution. 


--
--                                                        ___________________
  R.Stewart(Stew) Ellis, Assoc.Prof., (Off)313-762-9765  /   _____  ______ 
  Humanities & Social Science,  GMI Eng.& Mgmt. Inst.   /        / /  /  / /
  Flint, MI 48504      ellis@nova.gmi.edu              /________/ /  /  / /
From: tomc@siesoft.co.uk (Tom Crossland)
Newsgroups: comp.unix.shell
Subject: jsh
Date: 8 Sep 92 13:47:39 GMT
Reply-To: tomc@siesoft.co.uk
Organization: Siemens Nixdorf Information Systems Ltd.

I was looking through a friends System V 4 system and found a shell (I think)
called jsh. There was nothing about it in the man pages, so can somebody tell
me what it is?

Thanks,

Tom.
Newsgroups: comp.unix.shell
From: chapin@ssvax.gte.com (Barry Chapin)
Subject: Re: Need help putting PWD in PROMPT
Organization: GTE/SCSD
X-Newsreader: Tin 1.1 PL5
Date: Tue, 8 Sep 1992 19:40:41 GMT

Preston Beach (pbeach@abacus.bates.edu) wrote:
: Dear Netland,
:   I want to get my prompt to give my current working directory all the time.
: I need this for an Ultrix and BSD system. If anyone knows of a script or
: shell file which will do this please send it my way. Thanks very much.
: 				-Preston
: p.s. I am using csh. btw
: 
: Preston Beach
: Email : pbeach@abacus.bates.edu
: Bates College
: Lewiston, ME

In you .cshrc file, you want to put a line like this:
if ($?prompt) then set prompt="Preston at `pwd` \!: "

this will give you a prompt that look like this
Preston at /usr/Preston 1:

when you log in.  The 1 is the number of the current
command that you are entering, useful for history information.
This will set it correctly, until you cd to another directory.
Thus, you must also put this line in you .cshrc file:
alias cd 'cd \!*;set prompt-"Preston at `pwd` \\!: ";ls -C'

Note that this also adds the feature of doing an ls of the 
directory which you changed to.  The line basically redefines
the cd command to cd to the text which occurs on the remainder of
the line after you typed cd, and then also sets your prompt to be
what you enter in double quotes, and gives you the history number of 
that command and does the ls for you.  You do not have to 
include the history or the ls stuff if you dont want, I just copied
it from my file.

Good Luck.
-BC.
From: tlg@uknet.ac.uk (Tim.Goodwin)
Newsgroups: comp.unix.shell
Subject: Re: Could someone help me with script?
Date: 8 Sep 92 16:20:37 GMT
Organization: UKnet

In article <1992Sep5.080946.4918@u.washington.edu> micah@hardy.u.washington.edu
(Micah Anderson) writes:
>is there a flag in uniq that will remove BOTH addresses if there are
>two duplicate lines? If there is (I can't find one in the man pages) then
>I can simply go cat unsub >> /com/mailer/TMBG/USERS and then uniq out
>BOTH addresses (after a sort)... or should I go about this another way?

Try

        comm -23 /com/mailer/TMBG/USERS unsub

Tim.
-- 
perhaps if people had understood fork() better we | ; who am i
wouldn't have threads - Rob Pike.                 | uknet.ac.uk!tlg
Newsgroups: comp.unix.shell
From: wonga@steam.chem.su.oz.au (Adrian Wong)
Subject: Alias and awk variables
Organization: Dept. of Theoretical Chemistry, University of Sydney
X-Newsreader: Tin 1.1 PL5
Date: Mon, 14 Sep 1992 03:36:54 GMT

How do make this command into a csh alias,

ps -ef | awk '$1 !~ /root/ {print $0}'

I've tried almost every permutation of backslashes and single/double
quotes and can't get it to work.


-----------------------------------------------------------------------------
Adrian Wong, Dept.of Theoretical Chemistry     wong_a@summer.chem.su.oz.au
University of Sydney NSW 2006 Australia        061-2-692 4137
Newsgroups: comp.unix.shell
From: kopacik@mff.uniba.cs (Ivan Kopacik)
Subject: Tcsh&unknown characters(PLEASE HELP)
Organization: Faculty of Maths & Physics, Comenius University, Bratislava, Czechoslovakia
Date: Thu, 10 Sep 1992 16:55:05 GMT

Hi!

I use tcsh and I want to print unknown characters ( i.e. those
that are neither printable nor control ), but _NOT_ in format
\nnn. My terminal is in 8-bit mode. It works under csh
but not under tcsh. How to setup tcsh?
Any info would be great appreciated.

bye
Ivan

				  kopacik@mff.uniba.cs
Newsgroups: comp.unix.shell
From: alan@hal.larc.nasa.gov (alan dare)
Subject: awk & echo under bourne
Originator: alan@hal.larc.nasa.gov
Organization: NASA Langley Research Center, Hampton, VA  USA
Date: Mon, 14 Sep 1992 19:13:00 GMT


I have a question on echo'ing and awk under the bourne shell.

First the awk question:

num=`grep NUM_OF_DISPLAYS displays.h| cut -d" " -f3`
cat display_table.h |awk '$2 == $num {print $0}' >> temp

The variable num is set from looking into one file. The value of this
variable resides in the second column on one line in a different file. I
want to access this with awk, but I cant get awk to resolve the value of num.  
Can awk access my shell variable?

The echo'ing question:

junk="start"
echo "finish_$junk"	# Works
echo "$junk_finish"	# Doesn't work

How do I get "start_finish" using only one echo (using two echos and "\c"
has caused me some problems when its used to pipe into another command)?

Thanks for any and all help
-- 

*********************************************************************
Alan Dare                     |  Internet : alan@hal.larc.nasa.gov
NASA Langley Research Center  |
From: Eric.Arnold@Sun.COM (Eric arnold)
Newsgroups: comp.unix.shell
Subject: Re: Shell types (May be FAQ)
Date: 8 Sep 92 23:24:35 GMT
Reply-To: Eric.Arnold@Sun.COM
Organization: Sun Microsystems, Inc.
NNTP-Posting-Host: animus.corp.sun.com

In article 715982479@majors1.cs.duke.edu, bfl@duke.cs.duke.edu (Brian Loss) writes:
>In reading this newsgroup, I have seen all sorts of different shells
>mentioned (tcsh, zsh, ksh, bash, etc.).  Could someone tell me what the
>differences between all these are, and what all of their advantages and
>disadvantages are?  Thanks.
>
>Brian Loss
>P.S.  If this is a FAQ, then please repost the FAQ list--I have not seen
>	it recently.
>
>-- 
>Department of Computer Science, Duke University, Durham, NC 27706
>Internet:	bfl@cs.duke.edu
>UUCP:		mcnc!duke!bfl


I don't know about an FAQ posting, but I'll spout my oppinion.  After
trying all of those above, I settled on the "zsh".  I was looking for:


- Bourne shell syntax.
  This is because most system scripts are Bourne shell, and
  it tends to have the most mature quoting and parsing.  I've written
  some scripts using "csh", and I was always thwarted by some
  strangeness that turned out to be a widely know oversite in the
  language.

  I think the list of Bourne shell compatibles include "zsh", "ksh",
  and "bash".  "tcsh" would have done OK in some respects, like
  interactive functionality, but for its "csh" nature.

- Job control.
  This tends to be standard amongst everything but "/bin/sh".

- History editing.

  Most of the shells seemed to allow history editing, either using "vi"
  or "emacs" styles.

- Ergonomics for interactive accelerators.

  One of the really neat (delightful even :-) things about "zsh" is
  that you can just type "TAB" and it will expand almost ANYTHING:
  file names, command names, user names, history (E.g. "!?ls?:$"),
  wildcards, commands (E.g.  `pwd`/), environment variables, display
  and toggle through options, and maybe more.  Other shells have you
  typing a variety of control characters to get the same effects --
  meaning you just won't use them on a regular basis if you have to
  type "meta-control-shift-whatsit" to have it expand a wildcard, and
  "control-meta-alt-esc-whosit" (*) to expand a command.
 
 
  (*) Hyperbole added.

- Other stuff:

  There is a lot of other stuff you get with "zsh" and others which you
  might like, (especially integer variable types like in "csh"), but I
  don't tend to use any, except for setting up my personal interactive
  environment, because it wouldn't be portable.  For scripts, I try to
  restrict myself to either "perl" (for the real work) or "/bin/sh" (for
  the trivial/boot-up-level work).


So that's my proselytism for "zsh".  Obviously, I'm happy with it.

-Eric

Eric.Arnold@Sun.COM

(I think a disclaimer might actually apply here, so:  "Neither I, nor anyone
else (especially my employer), said or believes any of the preceding message." )
From: chet@odin.ins.cwru.edu (Chet Ramey)
Newsgroups: comp.unix.shell
Subject: Re: zsh function/positional parameter question...
Date: 14 Sep 1992 14:18:27 GMT
Organization: Case Western Reserve University, Cleveland, OH (USA)
Distribution: usa
NNTP-Posting-Host: odin.ins.cwru.edu

In article <1992Sep13.022329.21461@beaver.cs.washington.edu> maupin@cs.washington.edu (Ken Maupin) writes:
>following does not work...
>
>	function var () { echo $$1 }

Use

var()
{
	eval echo \$$1
}

This works in bash, at least.

Chet
-- 
``The use of history as therapy means the corruption of history as history.''
	-- Arthur Schlesinger

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu
Newsgroups: comp.unix.shell
From: subbarao@tex.Princeton.EDU (Kartik Subbarao)
Subject: Re: zork shell
Organization: Princeton University
Date: Sat, 12 Sep 1992 23:12:59 GMT

In article <PALMERP.92Sep11135715@phoebus.math.orst.edu> Paul Palmer <palmerp@math.orst.edu> writes:
>In article <laqbkuINN34i@jethro.Corp.Sun.COM> Eric.Arnold@Sun.COM (Eric arnold) writes:
>
>   In article 2003@drycas.club.cc.cmu.edu, naraht@drycas.club.cc.cmu.edu (Randolph J. Finder) writes:
>   >Can anyone tell me where I can download zork shell (zsh)?
>
>   I've gotten versions from either "cs.ucsd.edu" or "ftp.cs.uow.edu.au".

>Does the "z" in zsh really stand for "zork"? If so, why?

Please try zsh, but no, zsh is NOT the zork shell.

>When I read the original post, I thought he meant something like the 
>Adventure Shell. 
>

Correct -- What the poster wants is 'ash', the Adventure Shell, not zsh,
the Z-shell.

	-Kartik
From: smr@hitkw14.pki-nbg.philips.de (S.Riehm)
Newsgroups: comp.unix.shell
Subject: Re: Any known bugs for tcsh (6.02)
Date: 9 Sep 92 10:03:50 GMT

Harald.Eikrem@delab.sintef.no writes:

>prt7u@holmes.acc.Virginia.EDU (Peter R. Thorsen Jr.) asks:
>! I just compiled tcsh-6.02 and was wondering if there were any
>! known bugs and if so what they are for this particular version.
>! 
>! It would really help a lot and save me a lot of time testing
>! everything.

I have compiled up tcsh6.02 on hpux, and on our system we have a
problem with ownership of tty's, which produces the following:
( an extract from my "slightly modified" manpage to warn the local
users )
---
When tcsh is started, you will sometimes receive the message:
	    setpgid:Warning: no access to tty (Not owner).  Thus no job
	    control in this shell.

This is a problem which has received the following responses from the
following people:

TCSH Authors
	There is something wrong with your operating system (hpux).

Our Sysadmins
	Tcsh is not supported software, therefore its YOUR problem.

Hewlett Packard
	There is something wrong with tcsh.

If you find the answer, please let me know! The shell is still usable,
however, any background processes that are started won't be run in the
background.  For now the only solution seems to be to log out of that
shell and try again.
---

I am inclined to think it is our setup, but it doesn't effect any of
the other shells that we have on our systems.

thanks in advance

-----------------------------------------------------------------
Stephen Riehm		Configuration Management	   _-_|\ 
smr@pki-nbg.philips.de	Philips Kommunikations Industrie  /     \
Work: +49 911 526 2975	N|rnberg, Germany		  \_.-.*/
Fax:  +49 911 526 2095	"I was there, now I am here!"	       v 
"My company speaks another language, I CAN'T speak on it's behalf"
From: khan@us17501.mdc.com (Naseer Khan)
Newsgroups: comp.unix.shell
Subject: TCSH and FTP
Date: 15 Sep 92 16:33:27 GMT
Organization: Somewhere in Sunny Southern California
X-Useragent: Nuntius v1.1.1d9
X-Xxmessage-Id: <A6DB5DC98202CDAB@l33359.mdc.com>
X-Xxdate: Tue, 15 Sep 92 17:30:49 GMT

Hi All,

A while back, just as I was starting to learn about TCSH, someone was
discussing the effects of changing one's default login shell and how
FTP daemon reacted to this.  I think the important point was that we
had to let it know about the new shell (and also about the old ones)
in a config file of sorts.  Could that someone or anyone who can help
please tell me how to do this exactly.  I didn't realize at the time
that this would affect me, but now that I have gotten TCSH (6.02) and
have it as my login shell, FTP won't let me in from outside 'cause it
doesn't know my shell.  Thanks in advance. :)

      |      |                        Signed:  Naseer Khan
      | (~)(o)                                 ___________
     C      _)
      | ,___|                                  khan@us17501.mdc.com
From: dattier@ddsw1.mcs.com (DWT)
Newsgroups: comp.unix.shell
Subject: Re: Problem with cd in ksh
Date: 13 Sep 92 16:21:18 GMT
Organization: Contributor Account at ddsw1, Chicago, Illinois  60657

akachhy@cbnewsl.cb.att.com (avinash.kachhy) wrote in
<1992Sep11.154200.12351@cbnewsl.cb.att.com>:

| I am using kah on a SUN machine running SunOS. When I execute
| cd anydir
| I get an error message from ksh that "anydir was not found"
| I must execute the cd command as follows to change directory.
| cd ./anydir

It sounds as though your CDPATH variable contains neither . nor the specific
directory you were in at the time.

The arguments against having . in your $PATH do not apply to $CDPATH.  It's
safe to have it in $CDPATH, even to have it first.

David W. Tamkin   Box 59297   Northtown Station, Illinois  60659-0297
dattier@ddsw1.mcs.com    CompuServe: 73720,1570    MCI Mail: 426-1818
Newsgroups: comp.unix.shell
From: d-lewart@uiuc.edu (Daniel S. Lewart)
Subject: Re: Problem with cd in ksh
Originator: lewart@rsm1.physics.uiuc.edu
Reply-To: d-lewart@uiuc.edu (Daniel S. Lewart)
Organization: UIUC Physics Department
Date: Fri, 11 Sep 1992 19:35:40 GMT

In article <1992Sep11.154200.12351@cbnewsl.cb.att.com> akachhy@cbnewsl.cb.att.com (avinash.kachhy) writes:

> I am using kah on a SUN machine running SunOS. When I execute
> cd anydir
> I get an error message from ksh that "anydir was not found"
> I must execute the cd command as follows to change directory.
> cd ./anydir

Your CDPATH environment variable might be messed up.

Daniel Lewart
d-lewart@uiuc.edu
From: donn@carson.u.washington.edu (Donn Cave)
Newsgroups: comp.unix.shell
Subject: Re: KSH: how to stop $ENV
Date: 14 Sep 92 16:13:29 GMT
Organization: University of Washington

space%bnr.ca (Scott Pace) writes:

>Donn Cave (donn@carson.u.washington.edu) wrote:
>: space%bnr.ca (Scott Pace) writes:
>: 
>: | I have a shell script written in ksh (i.e. has #! /bin/ksh at the start).
>: | How do I prevent the ksh from executing $ENV?  This is on HP-UX 7.05.  I
>: | have read the man page, and I don't see any switches that would do this.
>: | What I really want is the equivalent of the -f switch in the csh.
>: 
>: #!/bin/ksh -p


>But I can't use -p since it clobbers the $PATH variable, and I need that to
>be kept intact.

It doesn't do anything to PATH, for me.  Of course that's without setuid
(does anyone write setuid shell scripts anymore?), and without the
/etc/suid_profile mentioned in another posting (I don't believe I have
any documentation for that, either.)

So, does anyone want to comment on whether the "-p" flag is reliably
available, or only in certain versions, or only at the discretion of
the vendor?

	Donn Cave, University Computing Services, University of Washington
	donn@cac.washington.edu
From: friedman@gnu.ai.mit.edu (Noah Friedman)
Newsgroups: comp.unix.shell
Subject: Re: Shell Scripts vs. C programs
Date: 5 Sep 92 09:01:08 GMT
	<FRIEDMAN.92Sep2045423@nutrimat.gnu.ai.mit.edu>
	<1992Sep2.142212.29524@osf.org>
Organization: Free Software Foundation, 675 Mass Ave. Cambridge, MA 02139
In-reply-to: rsalz@osf.org's message of 2 Sep 92 14:22:12 GMT

In article <1992Sep2.142212.29524@osf.org> rsalz@osf.org (Rich Salz) writes:
>In <FRIEDMAN.92Sep2045423@nutrimat.gnu.ai.mit.edu> friedman@gnu.ai.mit.edu (Noah Friedman) writes:
>>fork is expensive and it's not going to get better any time soon ...
>> and exec is even worse
>
>I am totally dismayed and depressed by this attitude:  "The OS isn't fast
>enough so I will glom all the features I might ever need into my program."
>Is it not totally obvious to you that this mindset is BROKEN!?

   It's not a matter of broken mindsets.  It's the truth: there is no
incentive for all the unix vendors out there to do anything about it.  Most
of them are just using the Evil One's code anyway.  Besides, how would you
go about making fork faster?  Even with COW pages you have to go mark them
all to get write faults.  In a large process, going through all those pages
still takes time.  Exec is not particularly fast in *any* OS I've ever
used, and my (admittedly limited so far) experience suggests it's a
difficult problem.

   And, for the record, I don't think having a lot of functionality in one
program is a bad thing, any more than I think interpreters in general are
bad.  A careful, modular and orthogonal design would make large programs
perfectly reasonable.  Perl is a bad example (and so is GNU Emacs).  Yes,
I'm aware of the problems of program size and complexity.  No one said
careful planning was easy either.
Newsgroups: comp.unix.shell
From: lappala@unlinfo.unl.edu (Kris Lappala)
Subject: HELP w/ ex
Keywords: HELP w/ ex editor
Organization: University of Nebraska - Lincoln
Distribution: g
Date: Thu, 10 Sep 1992 13:22:56 GMT

I am using the ex editor in a shell program and need to suppress the 
interactive feedback to the user. Here is a copy of my code:

CSHRC=/tmp/cshrc

string="`grep $1 ${CSHRC}`"

if [ -z "$string" ]
then
echo "setenv $1 $2" >> ${CSHRC}

else
ex - | -s  ${CSHRC}  <<-end_of_edit
/setenv *$1
d
i
setenv $1 $2
.
w
q
end_of_edit

fi

if anyone can help with this problem please write.
thanks  lappala@cse.unl.edu