HDTenEightyP/NetNews huggingface dataset:
From: jerry@incc.com (Jerry Rocteur)
Newsgroups: comp.unix.shell
Subject: Re: Alias in CSH and KSH
Summary: ksh
Date: 9 Oct 92 20:31:41 GMT
Organization: InCC.com Perwez Belgium

In article <1992Oct9.012128.12560@cas.org>, lwv26@cas.org (Larry W. Virden) writes:
> In article <s913300.718528128@rubicon> s913300@rubicon (Nga Tran) writes:
> :
> :	I would appreciate if someone can show me how to convert my alias
> :	from csh to ksh:
> :
> :		i.e: 	from csh:
> :
> :				alias grap 'grep -i \!* /etc/passwd'
> :
> :		  	to ksh
> :
> :				alias ....
> :
> 
> Sorry to post this, but since there was no usable address that I could
> decypher in that msg, I dont know how to email the person.  Just the
> time one needs a $HOME/.signature file...
> 
> You don't use alias in ksh for this type of thing:
> 
> function grap
> {
> grep -i "$@" /etc/passwd
> }
 
 Why not?????
  
  I tried it and you are quite right, ksh does not work when you
  have an alias for this, when I do:

  alias -x grap='grep -i $* /etc/passwd'

  and I run it I get grep can't open ... where ... is the argument!  

  yet, I can have:

  alias -x j='ls -l $*'

  and it works like a charm, I just want to know WHY ?????

  Anyone know ????
-- 
 __^__                                                              __^__
( ___ )------------------------------------------------------------( ___ )
 | / | Jerry Rocteur                       Email: jerry@InCC.COM    | \ |
 | / |             Independent Computer Consultants                 | \ |
 | / |--------------------------------------------------------------| \ |
 | / | C didn't spring full-grown from Ritchie's head, however, it  | \ |
 |___|  came from Thompson's B Language, but that's another story   |___|
(_____)------------------------------------------------------------(_____)
   ^                                                                  ^
From: dhami@cs.ubc.ca (Mandeep S Dhami)
Newsgroups: comp.unix.shell
Subject: Re: another "shell funny"
Date: 9 Oct 1992 22:51:42 -0700
Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
NNTP-Posting-Host: valhalla.cs.ubc.ca

dt@yenta.alb.nm.us (David B. Thomas) writes:
>
>Perhaps this isn't as funny as
>$ ar t God
>ar: God does not exist
>
>but I just came up with this one:
>$ mkdir describe_quayle
>$ ls -l describe_quayle
>total 0
>

Here's another (works best on MIPS! SUNOS adds an extra word):

$ make love
Make:  Don't know how to make love.  Stop.

Mandeep.
----------------------------------------------------------------------
Those who do not understand Unix are condemned to reinvent it, poorly.
                                                      -- Henry Spencer
----------------------------------------------------------------------
Newsgroups: comp.unix.shell
From: dejesus@archimedes.nwc.navy.mil (Francisco X DeJesus)
Subject: I/O redirection in csh
Organization: Science Applications International Corp.
Date: Wed, 14 Oct 1992 17:40:30 GMT

Apologies in advance if this is a FAQ, but since I haven't seen the FAQ being
posted recently...

In a Bourne shell script, I can redirect the output of the script to a file
by using the command:

exec > filename 2>&1

From that point on, any output from the commands in the script goes to that
file. Is there a (simple) way to accomplish this in the C-shell (and please,
no "why are you using the C-shell in the first place?" replies :-)

Thanx...

-- 
Francisco X DeJesus  ----- S A I C -----  dejesus@archimedes.chinalake.navy.mil
disclaimer: "Opinions expressed here are mine. Typos and errors are all yours."
From: kevinl@tisdec.tis.tandy.com
Date: 09 Oct 92 16:19 CDT
Newsgroups: comp.unix.shell
Subject: Re: Alias in CSH and KSH
Message-ID: <28300006@tisdec.tis.tandy.com>
Nf-ID: #R:rubicon:718528128:tisdec.tis.tandy.com:28300006:000:973
Nf-From: tisdec.tis.tandy.com!kevinl    Oct  9 16:19:00 1992


>
>/* Written  2:08 am  Oct  8, 1992 by s913300@rubicon.UUCP in tisdec.tis.tandy.com:comp.unix.shell */
>/* ---------- "Alias in CSH and KSH" ---------- */
>
>	I would appreciate if someone can show me how to convert my alias
>	from csh to ksh:
>
>		i.e: 	from csh:
>
>				alias grap 'grep -i \!* /etc/passwd'
>
>		  	to ksh
>
>				alias ....
>
>	Thanx advance.
>/* End of text from tisdec.tis.tandy.com:comp.unix.shell */

	As far as I know, there is no way to put arguments into a
Korn Shell _alias_, but you can make a Korn Shell _function_
that works like an alias.
	In my .kshrc (you can put then in your .profile as well) I have
things like this:

function l {
	ls -alF $* | less
}

When I type l<cr> I get a long directory listing piped through 'less'
(that's GNU's file viewing utility - like 'more').  The syntax is
similar to that of shell scripts.

So you could make your alias a function as follows:

function grap {
	grep -i $* /etc/passwd
}

Hope this helps.

Newsgroups: comp.unix.shell
From: elliott@quando.quantum.de (David Elliott)
Subject: Re: alias problem in tcsh
Organization: Quantum Software GmbH, Dortmund, Germany
X-Newsreader: Tin 1.1 PL5
Date: Fri, 16 Oct 1992 09:42:06 GMT

Thilo Wunderlich (c15o@alf.zfn.uni-bremen.de) wrote:
: Hi folks !
: I'm trying to make an alias in tcsh but it won't work.
: I'd like to do: nohup batchftp -i ***filename*** &
: so I wrote: alias batch "nohup batchftp -i $* &" in my .cshrc file
: and start it with: batch name 
: But batchftp complains that I have no filename.
: What is the solution to my problem ?

Im sure you'd find the answer in the man page for csh - look under the bit
about aliases, yep here is an example from my csh man page:

		  alias  lm 'ls  -l  \!*  |  more'

So the answer to your question is to do the following:

alias batch 'nohup batchftp -i \!* &'


Dave
-- 
me    : C. David Elliott   
email : elliott@quantum.de 
And now - the .signature that the word has been waiting for! How YOU TOO can
make millions - all in the space of a .signature! Step 1 - first of all you
Newsgroups: comp.unix.shell
From: lwv26@cas.org (Larry W. Virden)
Subject: FCEDIT program?
Followup-To: comp.unix.shell
Reply-To: lvirden@cas.org (Larry W. Virden)
Organization: Nedriv Software and Shoe Shiners, Uninc.
Date: Fri, 9 Oct 1992 01:22:12 GMT

Has anyone written their own FCEDIT program to use with ksh?  Tell us a bit
about them.  What in particular I would be interested in hearing about is
a FCEDIT program which would end up looking a bit more like csh - allow
me to do things like global replacement of strings against a particular
history item, retrieve specific arguments and change their orders, etc.
with minimal keys input by me.

fc just frustrates me sometimes - I don't WANT to have to do multiple
actions to replace all occurances of abc with xyz in a command line - I
want to do something like

r /abc/xyz/g

and allow regular expressions on both sides of the equation.  Hmm - I 
wonder if sed or perl could somehow be used as an FCEDIT type program...
-- 
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
America Online: lvirden@aol.com
Newsgroups: comp.unix.shell
From: heinlein@fireball.stanford.edu (John Heinlein)
Subject: How to _repeat_ a compound command in csh/tcsh
Organization: /roadkill/rk3/heinlein/.organization
Distribution: comp
Date: Fri, 16 Oct 1992 23:32:26 GMT



I'm looking for a way to repeat a compound command using the csh (actually,
tcsh) built-in command repeat, but short of putting the commands in a script,
I can't seem to get it to work:

 % repeat 5 ls

works fine, but

 % repeat 5 ls ; sleep 1

doesn't work because it runs two ls's then sleep.  Instead, I want a sleep
after each ls.  Ok, so I tried 

 % repeat 5 'ls ; sleep 1'  or
 % repeat 5 "ls ; sleep 1"  

but they don't work because the shell then interprets the entire string as the
command name. 

Is there a way to accomplish this type of repetition on the command line, or
is it just not possible?

Thanks,

John.




--
/---------------------------------------------------------------------\
|John Heinlein                 heinlein@leland.stanford.edu           |
|Stanford University                                                  |
\---------------------------------------------------------------------/
Newsgroups: comp.unix.shell
From: c15o@alf.zfn.uni-bremen.de (Thilo Wunderlich)
Subject: alias problem in tcsh
Keywords: tcsh
Organization: Univ. Bremen, Informatik
Date: Fri, 9 Oct 1992 19:17:00 GMT

Hi folks !
I'm trying to make an alias in tcsh but it won't work.
I'd like to do: nohup batchftp -i ***filename*** &
so I wrote: alias batch "nohup batchftp -i $* &" in my .cshrc file
and start it with: batch name 
But batchftp complains that I have no filename.
What is the solution to my problem ?
Thanx for your support
Please mail your answers to me.

Thilo
--
Thilo Wunderlich    c15o@alf.zfn.uni-bremen.de
From: jeffs@almaden.ibm.com (Jeff Schneiter)
Newsgroups: comp.unix.shell
Subject: Re: printing to a file with streams
Date: 13 Oct 92 22:32:37 GMT
Reply-To: jeffs@almaden.ibm.com (Jeff Schneiter)
Organization: IBM Almaden Research Center

I had asked the question, then found the answer thru someone elses problem.

In article <2036@coyote.UUCP> jeffs@almaden.ibm.com (Jeff Schneiter) writes:
>
>print -u3 `lscfg`

lscfg >&3


|   Jeff Schneiter   |   jeffs@almaden.ibm.com    |   (408) 927 - 1498     |
----------------------------------------------------------------------------
|   "I just can't wait till this campaign is over so I can say:            |
|    'Bob, open the garage door and get out the Maserati! Open up          |
|    the safe and get out the jewels!'"                                    |
|                                       Georgette Mosbacher,               |
|        wife of Robert Mosbacher, George Bush's campaign chairman         |
----------------------------------------------------------------------------

Newsgroups: comp.unix.shell
From: lwv26@cas.org (Larry W. Virden)
Subject: Re: Alias in CSH and KSH
Followup-To: comp.unix.shell
Reply-To: lvirden@cas.org (Larry W. Virden)
Organization: Nedriv Software and Shoe Shiners, Uninc.
Date: Fri, 9 Oct 1992 01:19:30 GMT

In article <s913300.718528128@rubicon> s913300@rubicon (Nga Tran) writes:
:
:	I would appreciate if someone can show me how to convert my alias
:	from csh to ksh:
:
:		i.e: 	from csh:
:
:				alias grap 'grep -i \!* /etc/passwd'
:
:		  	to ksh
:
:				alias ....
:

Sorry to post this, but since there was no usable address that I could
decypher in that msg, I dont know how to email the person.  Just the
time one needs a $HOME/.signature file...

You don't use alias in ksh for this type of thing:

function grap
{
grep -i "$@" /etc/passwd
}

Of course, this will only work on a machine where the passwd file is
physically present - on a NIS/Yellow Paged system, one has to be fancier...

-- 
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
America Online: lvirden@aol.com
From: jrichter@sinix.UUCP (Juergen Richter)
Newsgroups: comp.unix.shell
Subject: Re: Alias in CSH and KSH
Date: 13 Oct 92 13:31:57 GMT
Organization: SNI AG Muenchen, STO XS

Answer to Nga Tran's question:
  grap() grep -i $* /etc/passwd
From: dennis@pteng.amdahl.com ( Dennis Potts )
Newsgroups: comp.unix.shell
Subject: Help with C-shell script
Date: 16 Oct 92 19:26:03 GMT
Reply-To: dennis@pteng.amdahl.com
Organization: Amdahl Corporation

As part of a cshell script I'd like to see if certain environment variables (ie. set by setenv) exist, because program execution is strongly dependant on certain variables.  Is there some feature similar to that used to check if a file exists? ie. similar to:

	if (-e $HOME/.login) then ......

For example, how would this be done with the variable $DISPLAY?

Any help would be appreciated.  Please reply by email.

Thanks,
Dennis Potts
(408) 737-5032
dennis@pteng.amdahl.com
Newsgroups: comp.unix.shell
From: ianh@nmpd.oz.au (Ian Holland)
Subject: Re: why spaces stripped off ??
Reply-To: ianh@nmpd.oz.au
Organization: NMPD Telecom
Date: 16 Oct 92 06:06:37 GMT

root@trebor.uucp (Bob Stockler) writes:

>minh@lis.rch.unimelb.edu.au (Minh Tran) writes:

>>	echo "enter here \c"
>>	read var
>>	echo $var

    {example deleted}

>"echo" is stripping off the spaces because its argument isn't quoted.  Try
>echo "$var", and see that the parameter 'var' does, indeed, contain them.

Correct solution, misleading explanation :-)

It is the shell that "strips" the spaces, not "echo".

Sorry to be pedantic - but it may save a life one day :-)

- ian...
--

Ian Holland                              Explicit hoc totum,
Telecom Australia                     Pro Christo da mihi potum!
ianh@nmpd.oz.au
Newsgroups: comp.unix.shell
From: RAHLFS@BEATE.RZ.FH-ULM.DE (RZ D. Rahlfs)
Subject: &| under the KornShell
Organization: FACHHOCHSCHULE ULM (GERMANY)
Date: Wed, 14 Oct 1992 07:55:09 GMT
X-News-Reader: VMS NEWS 1.22

I would like to have a simple, reasonable example for the usage of &|
in the KornShell. And a short description of what's going on.

Thanks
From: chet@odin.ins.cwru.edu (Chet Ramey)
Newsgroups: comp.unix.shell
Subject: Re: trap/sh -e question
Date: 8 Oct 1992 19:19:25 GMT
Organization: Case Western Reserve University, Cleveland, OH (USA)
NNTP-Posting-Host: odin.ins.cwru.edu

In article <1992Oct7.144849.28415@sinix.UUCP> jrichter@sinix.UUCP (Juergen Richter) writes:
>Can anyone explain to me according to which rules 
>1. "echo $?" will be called and
>2. what "echo $?" will output in the following script:
>
>  #!/bin/sh -e
>  trap 'echo $? ; exit' 0
>  ...
>  trap 0

Posix.2 says that the shell will exit if -e is set under the following
conditions:
	A simple command exits due to something like a redirection error,
	variable expansion error,  or command not found (all of the cases
	are listed in the standard)

	A simple command returns an exit status > 0 and is not:
		part of the test in a while, until, or if statement
		part of an AND or OR list
		in a pipline preceded with `!'
		
>...		output				exit status of ...
>==============================================================================
>[ ]		<none>				1

I think this is a bug in the AT&T sh.  Bash, ksh, and the new BSD sh
all echo `1'.  It's not that the AT&T sh has trouble with builtins
failing when -e is set, because changing the [ to /bin/[ results in
the same behavior.  The [ command itself certainly fails.

Running this script:

	trap 'echo "trap: $?" ; exit' 0
	[ ]
	echo "after: $?"

with both sh and sh -e produces identical results with the AT&T sh:

	odin(2)$ sh fff
	after: 1
	trap: 0
	odin(2)$ sh -e fff
	after: 1
	trap: 0

It's a bug.

>( [ ] )	1				1

The subshell begun to run [ ] exits with the status of the [, which is
1.  The script shell notices that a child has exited with a non-zero
status, and exits because -e is set.

>unknown	./ttt: unknown: not found	1
>		0

I believe this the same AT&T sh bug.  Bash, ksh, and the BSD sh all
echo `1' (which is wrong, incidentally.  According to Posix, the exit
status should be 127).

Though sh does take the trap -- commands following the `unknown' are
not executed -- it loses the exit status somewhere.

>( unknown )	./ttt: unknown: not found	1
>		1

Same as second example.

>( [ ] ) || :	<none>				0

Part of OR list.

>( [ ] ) && :	<none>				1

Part of AND list.

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: jpr@jpradley.jpr.com (Jean-Pierre Radley)
Subject: Re: #!/bin/sh | #!/bin/ksh ...
Organization: Unix in NYC
Date: Fri, 09 Oct 1992 23:02:14 GMT

In article <BvF77t.8Jt@mudos.ann-arbor.mi.us> mju@mudos.ann-arbor.mi.us (Marc Unangst) writes:
>          ":" is the archaic comment character for the Bourne shell,

I think not.

":", in the Bourne shell, is not an archaic comment character. It's a no-op
command, which does nothing, and does it successfully.

Characters which follow it ARE looked at by the shell.

	: test program ; date

will print the date.

	: test program ; to show what a ":" does

will produce the message
	
	to: not found

But
	: test program # to show what a ":" does

will print nothing.

And
	: doesn't care
	date

will also print nothing, since the single quote wasn't balanced with another
single quote.

The program

	while : 
	do
		date
	done

will keep outputting the date until interrupted, whereas

	while #
	do
		date
	done

will produce the syntax error that "do" is unexpected. The ":" in the former
example does act as a command which returns true to the 'while' command.
-- 
Jean-Pierre Radley   Unix in NYC   jpr@jpr.com   jpradley!jpr   CIS: 72160,1341
From: bih@mowgli.East.Sun.COM (Bennet Ih - Sun BOS Hardware - Sunergy)
Newsgroups: comp.unix.shell
Subject: Re: ksh, pipes, co-processes and stdout
Date: 13 Oct 1992 20:46:35 GMT
Organization: Sun Microsystems Inc. - BDC
Distribution: world
Reply-To: bih@mowgli.East.Sun.COM
NNTP-Posting-Host: mowgli.east.sun.com

Thanks to all who replied to my original question.

jrichter@sinix.UUCP (Juergen Richter) suggested using the following:

  { command >&3 |& } 3>&1 |  tee file

For some unknown reason (I am a ksh rookie) my co-process starts ok
but then immediately terminates. This program is an executable I wrote
using lex and yacc; I am guessing that the program is seeing an EOF or
something similar and decides it's time to close up shop (this program
executes fine without a front end or with my previous invocation). The other
ksh lines in my script also do not execute until after the co-process
terminates. Any suggestions out there on how to handle this? Again, thanks
in advance.

-Bennet
From: s913300@rubicon (Nga Tran)
Newsgroups: comp.unix.shell
Subject: Alias in CSH and KSH
Date: 8 Oct 92 07:08:48 GMT
Organization: RMIT Computer Centre
NNTP-Posting-Host: rubicon.bf.rmit.oz.au


	I would appreciate if someone can show me how to convert my alias
	from csh to ksh:

		i.e: 	from csh:

				alias grap 'grep -i \!* /etc/passwd'

		  	to ksh

				alias ....

	Thanx advance.
From: klaus@helsinki.esf.de (Klaus Wicovsky)
Newsgroups: comp.unix.shell
Subject: tar files
Date: 9 Oct 92 13:35:52 GMT
Reply-To: klaus@helsinki.esf.de (Klaus Wicovsky)
Organization: ESF Headquarters, Berlin, FRG



When I am trying to "tar xvf tarfile" and tarfile is very small I get an error message (blocksize = 8), although tar does untar the file. 

Now, this is very disturbing, because my tar doesn't deliver an exit status and I have to check if it prints something to stderr to see if it worked correctly.

I found that I can use "tar xvbf 1 tarfile" in order to avoid this error message. 

My question is: what is the effect of using a blocking factor of 1 (I believe the default is 20) rather than the default? Is there any other way in which I can detect if everything worked out right with my tar command?

Any help is appreciated.


-----------------------------------------------------------------

   Klaus Wicovsky                                                   
                                                                    
   ESF Headquarters                    Tel : ++49+30-820 903 47      
   Hohenzollerndamm 152                Fax : ++49+30-820 903 19      
   1000 Berlin 33                      UUCP: klaus@esf.de        
   Germany             
Newsgroups: comp.unix.shell
From: rick@opus.alf.dec.com (Rick Silverstein)
Subject: Re: Losing variable outside a while loop
Reply-To: rick@opus.alf.dec.com (Rick Silverstein)
Organization: Digital Equipment Corporation
Date: Mon, 12 Oct 1992 19:38:31 GMT


Sh forks a child to do the read so it can redirect stdin.  
So any variables you change within the while loop are in
the child's environment and do not get passed back to the
parent.

Rick
Newsgroups: comp.unix.shell
From: root@trebor.uucp (Bob Stockler)
Subject: Re: How to calculate the Date of Easter?
Organization: Bob Stockler
Date: Sat, 10 Oct 1992 00:01:40 GMT

digdon@ug.cs.dal.ca (Mike Digdon) writes:

>Are you sure that spring is fixed? I always thought that it could fall on
>either the 21st OR the 22nd.. regardless, your calculation of Easter is
>correct..

Your are correct in saying that "spring" is not fixed.  You neglected to
consider earlier messages in this thread that pointed out that different
calendars are used to fix the date of Easter in various branches of the
Christian church.

Next question:  Do something for for Yom Kippur.

Newsgroups: comp.unix.shell
From: casper@fwi.uva.nl (Casper H.S. Dik)
Subject: Re: Losing variable outside a while loop
Organization: FWI, University of Amsterdam
Date: Tue, 13 Oct 1992 08:31:21 GMT

nevin@apple.com (Nevin ":-]" Liber) writes:

>In article <1992Oct12.172333.5037@progress.com>,
>tucker@bedford.progress.COM (Kyle Tucker) wrote:

>Change:

>> cat ${TMPFILE} | while read LINE
>> do
>>     [...]
>> done

>to:
>    while read LINE
>    do
>        [...]
>    done < ${TMPFILE}

>You can always replace constructs of the form:
>    cat file | command
>with
>    command < file

>This is always more efficient, since the "cat" command doesn't need to be
>executed, and the right side of the pipe does not need to be executed in a
>subshell.  In the above example, this also has the benefit of preserving
>any shell variables set within the while loop.

Of course, you should have tried this on a system like the original
poster has. Posix mandates that the loop is executed in the shell
itself rather than in a subshell. At least in the case you suggest,
I'm not sure about the cat case. The SunOS 4.x shell isn't Posix
compliant in this respect. Ksh works in both cases.

Casper
Newsgroups: comp.unix.shell
From: peter@merlin.acadiau.ca (Peter Steele)
Subject: Has anyone got zsh working on RiscOS?
Organization: Acadia University
Date: Wed, 7 Oct 1992 12:03:23 GMT

I guess the subject says it all. I would like to give zsh a try, but
we have Sun equipment as well as a box running a RiscOS (MIPS) variant.
Has anyone got zsh to work on zsh? I get a segmentation fault...
--
Peter Steele        Unix Services Manager            peter.steele@acadiau.ca 
Acadia Univ., Wolfville, NS, Canada B0P 1X0  902-542-2201  Fax: 902-542-4364
From: jrichter@sinix.UUCP (Juergen Richter)
Newsgroups: comp.unix.shell
Subject: Re: force alias ?
Date: 7 Oct 92 13:55:59 GMT
Organization: SNI AG Muenchen, STO XS

Answer to Morgan Stanley's question:
Set (and export) MWMSHELL to /bin/ksh in the script that starts your mwm.
From: guest@westford.ccur.com (Guest users)
Newsgroups: comp.unix.shell
Subject: escape chars in ksh functions..
Date: 14 Oct 92 15:46:37 GMT
Article-I.D.: westford.1992Oct14.154637.8826
Organization: Concurrent Computer Corp.  Westford, MA


        With X-windows one can set the title of the window and the name of the
icon with a set of escape sequences. I am trying to set up a mechanism so that
the window title will be set up according to the machine I am on and the dir
I am in.

        I set up a function so that the function would reset the title.

function settitle
{
        machine=${HOSTNAME}
        directory=${PWD}
        echo  '\033]1$machine:$directory'
}

        Unfortunately the $machine:$directory does not get expanded with the
"'" and the escape sequence does not get passed correctly with the """. Anyone
have any ideas to do this ?

        Arun
E-MAIL ADRESS::
	arun@tinton.ccur.com