HDTenEightyP/NetNews huggingface dataset:
From: posse@masg6.epfl.ch (Christian Posse)
Newsgroups: comp.unix.shell
Subject: "if () then" file tests in sh/csh/tcsh
Date: 8 Sep 92 07:53:48 GMT
Organization: Swiss Federal Institute of Technology

Hi shells gurus !

In the man of sh/csh/tcsh and the FAQ, I have not found a description of
the file tests in "if" expressions :

What means "if ( -d file && -x file) then". 
Which parameters are available and for what (-d, -x, -t, .. ?)
Which complexity is possible : how many ()/&&/... I guess && means "or"
but which symbol for "and" ....

Is there a documentation available ?

Many thanks in advance.

Christian.


-------------------------------------------------------------------------------
     ____/  __  /  ____/   /   Christian POSSE
    /      /   /  /       /    Swiss Federal Institute of Technology
   ____/  ____/   ____/  /     DMA-Ecublens                                   
  /      /       /      /      CH-1015 Lausanne (Switzerland)
_____/ _/      _/     _____/   
  			       e-mail : posse@masg6.epfl.ch  or
					posse@dma.epfl.ch

 ... Trying to establish voice contact ... please yell into keyboard ....
-------------------------------------------------------------------------------
Newsgroups: comp.unix.shell
From: dattier@ddsw1.mcs.com (David W. Tamkin)
Subject: Re: Substring of a file name
Organization: Contributor Account at ddsw1, Chicago, Illinois  60657
Distribution: usa
Date: Sun, 13 Sep 1992 03:17:55 GMT

jdell@golda.mit.edu (John Ellithorpe) wrote in
<JDELL.92Sep10180225@golda.mit.edu>:

| On 10 Sep 92 15:15:41 GMT, urs@carp.cis.ufl.edu (Uppili Srinivasan) said:

| > I need to write a script to read a substring of some of the filenames
| > in a directory. (i.e) if xy1992 is the name i need to read the last four
| > letters only. I guess 'awk' is ideal for this . But I am curious to
| > know the other ways of doing this.

| Well, if you knew that the first couple of characters were always characters

[I assume that Mr. Ellithorpe meant that they were always lower-case letters.]

| then you could use sed:
| 
| substring = `echo $file | sed -e 's/^[a-z][a-z]//'`
| 
| which would just delete out the first couple of characters.  Hope this
| helps.

If you knew you always needed the last four characters, you could do this:

substring=`echo $filename | sed 's/.*\(....\)/\1/'`

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: pbeach@abacus.bates.edu (Preston Beach)
Subject: Need help putting PWD in PROMPT
Organization: Bates College, Lewiston, Maine
Date: Tue, 8 Sep 1992 15:25:14 GMT
Originator: pbeach@abacus.bates.edu

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
From: apardon@rc1.vub.ac.be (Antoon Pardon)
Newsgroups: comp.unix.shell
Subject: Re: jsh
Date: 11 Sep 92 12:40:26 GMT
Organization: Brussels Free Universities (VUB/ULB), Belgium

jsh is probably a link to sh (at least on our system it is)
a shell started as enables job control in sh. Lookup sh(1)
and see under option "-J".

========================================================================
Antoon Pardon                                        <apardon@vub.ac.be>
Brussels Free University Computing Centre                   02/650.37.16
========================================================================
Newsgroups: comp.unix.shell
Subject: Re: HELP: Command-line editing with ksh/csh
From: abercrombie@mdcbbs.com (Phil Abercrombie)
Date: 11 Sep 92 10:12:30 PDT
Reply-To: abercrombie@mdcbbs.com
Organization: M&E (Division of EDS), Cypress CA
In-reply-to: sasmob@chewy.unx.sas.com's message of Thu, 10 Sep 1992 17:09:25 GMT


On Thu, 10 Sep 1992 17:09:25 GMT, sasmob@chewy.unx.sas.com (Mark C. Burhans) said:
*> In article <Bton03.99n@agora.rain.com>, chuff@agora.rain.com (Chris Hufnagel) writes:

|> Hi, I am running Amiga Unix v2.1 and unfortunatly, the included ksh/csh
|> don't seem include command-line editing capabilities.  When I use
|> the cursor keys or an ESC(J,K) combination I only get "[[A, [[B, [[C, [[D)"
|> etc.  Am I forgetting to set something or is there a patch,utility that
|> gives me back the sacred command-line editing abilityies?

*> Don't know how to get the arrow keys to work as command recall...yet...

*> but with ksh you can try:
*> set -o emacs
*>    ^P   Previous command
*>    ^N   Next command
*>    ^B   Back up a character
*>    ^F   Move forward a charcer
*>    ^D   Delete character
*>    ^K   Erase from cursor to end of line

With emacs mode (and recent revisions of ksh), you can set shell
aliases to interpret the escape codes generated by your arrow keys.

alias __A=""	# recall previous line
alias __B=""	# goto next line
alias __D=""	# go back in a line
alias __C=""	# go forward in a line

(I can't find this in my FM though...)
--
Phil Abercrombie       | Living in another country |    _~o _O   | BIKE TO
abercrombie@mdcbbs.com | Under another name        |   -\<,-\<,  | WORK   
                       |                           | (*)/===/(*) |
From: kheldar@prism.gatech.EDU (Garner)
Newsgroups: comp.unix.shell
Subject: Re: zork shell
Date: 12 Sep 92 04:42:29 GMT
Organization: Georgia Institute of Technology

In article <PALMERP.92Sep11135715@phoebus.math.orst.edu> Paul Palmer <palmerp@math.orst.edu> writes:
->When I read the original post, I thought he meant something like the 
->Adventure Shell. 

One of our professors mentioned the Adventure Shell.  A friend of his left
himself logged in and he changed his shell to Adventure.  Pretty funny 
actually.  Does anyone know where I can find a copy of it?  
-- 
_______________
Garner Halloran                                  garner.halloran@oit.gatech.edu
  "My philosophy of life is that the meek shall inherit
   nothing but debasement, frustration, and ignoble deaths..." - Harlan Ellison
From: jdell@zenobia.mit.edu (John Ellithorpe)
Newsgroups: comp.unix.shell
Subject: Help with awk
Date: 14 Sep 92 18:43:04 GMT
Distribution: comp.unix.shell
Organization: Massachusetts Institute of Technology

Hi,

I've got a question about awk.  I need to minimum match with a variable in 
a shell script.  What I want to do is something like:

#!/bin/sh
tstusr=$1
user=`awk -F: '$1 ~ /^$tstusr/ {print $1}' passwd`
echo $user

And in the passwd file is:

jdell:...

So, when I run the script:

% script jde
jdell

it should come up with the minimum matched username(s).  But I can't get
awk to recognize /^$tstusr/.  Is there a way to do this?

John
--

===============================================================================
John Ellithorpe                           | Internet: jdell@maggie.mit.edu
Dept. of Physics, Rm 26-349               | Phone   : (617) 253-3074  Office
Massachusetts Institute of Technology     |           (617) 253-3072  Lab
Cambridge, MA  02139                      |           (617) 236-4910  Home
===============================================================================
From: zhong@cs.UAlberta.CA (John (Zhong)   Li)
Newsgroups: comp.unix.shell
Subject: Help: How to exit from two shells?
Date: 15 Sep 92 17:53:30 GMT
Organization: University of Alberta


Hi,

Since some machines cannot support 'tcsh' shell I have to 
set up my default shell into 'csh'. But I like to use 'tcsh'
shell. After login, if possible, my '.login' will set 'tcsh'
automatically. However, since this kind of setting made 
'tcsh' is not the login shell it is annoying to exit. Every
time when I logout I have to type "exit", then "logout" or
"exit". Can anybody tell me a method to jsut type once by
making either a script or an alias, then I can directly 
exit from both 'tcsh' and 'csh' shells?

thanks in advance!


--
-----------------------------------------------------------------------------
| Li, John              | 492-5094 (office) | I haven't lost my mind,       |
| zhong@cs.ualberta.ca  | 492-2821 (lab)    | I know exactly where I left it|
-----------------------------------------------------------------------------
From: naraht@drycas.club.cc.cmu.edu (Randolph J. Finder)
Newsgroups: comp.unix.shell
Subject: zork shell
Date: 8 Sep 92 09:31:59 -0500
Organization: Carnegie Mellon Computer Club

Can anyone tell me where I can download zork shell (zsh)?


-- 
(naraht@drycas.club.cc.cmu.edu)	| Leadership,Friendship, and Service
(vri_rjfin@dmis.ha.osd.mil)	|          Alpha Phi Omega
(tnc!m0039@uunet.uu.net)	| National (Co-ed) Service Fraternity
"Service to others is the rent that we pay for living on the planet"(quote?)
Newsgroups: comp.unix.shell
From: jdell@golda.mit.edu (John Ellithorpe)
Subject: Re: Substring of a file name
Organization: Massachusetts Institute of Technology
Distribution: usa
Date: Thu, 10 Sep 1992 23:02:25 GMT

On 10 Sep 92 15:15:41 GMT, urs@carp.cis.ufl.edu (Uppili Srinivasan) said:
> Nntp-Posting-Host: carp.cis.ufl.edu
> Hi,
> I need to write a script to read a substring of some of the filenames
> in a directory. (i.e) if xy1992 is the name i need to read the last four
> letters only. I guess 'awk' is ideal for this . But I am curious to
> know the other ways of doing this.
>
> Thanx in advance
> My e-mail address : urs@carp.cis.ufl.edu

Well, if you knew that the first couple of characters were always characters
then you could use sed:

substring = `echo $file | sed -e 's/^[a-z][a-z]//'`

which would just delete out the first couple of characters.  Hope this
helps.

John
--

===============================================================================
John Ellithorpe                           | Internet: jdell@maggie.mit.edu
Dept. of Physics, Rm 26-349               | Phone   : (617) 253-3074  Office
Massachusetts Institute of Technology     |           (617) 253-3072  Lab
Cambridge, MA  02139                      |           (617) 236-4910  Home
===============================================================================
Newsgroups: comp.unix.shell
From: dhami@cs.ubc.ca (Mandeep S Dhami)
Subject: Re: Setting variables in Bourne Shell
Keywords: bourne shell
Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
Date: Wed, 9 Sep 92 17:10:34 GMT

kevinc@casey.uucp (Kevin C. Castner) writes:

># VARLIST is really set by a shell process
>VARLIST="3 4"

>for i in `cat ./test.db`
>do
>	for j in `echo $VARLIST`
>	do
>		P${j}=`echo $i | cut -f ${j} -d ':'`
          --->  ^^^^
>	done

>	echo "P1:${P1}, P2:${P2}"

>done


Use eval. You can not assign to $variable, but you may eval
such a string. To give you an example:
# X=A 
# Y=B
# $X=$Y
A=B: not found  # Same problem as yours, 
# eval $X=$Y    # The Solution
# echo $A
B


Mandeep
__________________________________________________________________
"I'm very brave generally," he went on in a low voice:
"only to-day I happen to have a headache."
                                      -- Lewis Carroll
__________________________________________________________________
From: fyl@ssc.wa.com (Phil Hughes)
Newsgroups: comp.unix.shell
Subject: Re: Korn Shell Beginnings
Date: 8 Sep 92 18:46:35 GMT
Organization: SSC, Inc.,  Seattle, WA
X-Newsreader: Tin 1.1 PL3

mjb@netcom.com (Martin Brown) writes:

: While the ksh book by Korn is the *specification* of the KornShell language,
: the book that really helps the most (IMO) is:
: 
:                 KornShell Programming Tutorial
:                 by Barry Rosenberg
...

And, don't forget the Korn Shell Reference, a pocket-sized fan-fold card
that summarizes the Korn Shell.  Good complement to Rosenberg's book.
(Note that this is a vested interest post as I work for the publisher.)
That warning said, the ISBN is 0-916151-50-6, it sells for $4.50 and is
available from some bookstores (Computer Literacy, Op Amp, Cucumber, ...)
or directly from SSC.  The card was written by Arnold Robbins.

-- 
Phil Hughes, SSC, Inc. P.O. Box 55549, Seattle, WA 98155  (206)FOR-UNIX
>>> Publishers of pocket references for UNIX, C, VI, Emacs, Ksh, MS-DOS, ... <<<
     uunet!nwnexus!ssc!fyl or fyl@ssc.wa.com            (206)527-3385
Newsgroups: comp.unix.shell
From: msb@sq.sq.com (Mark Brader)
Subject: Re: How to do $#a in Bourne shell?
Organization: SoftQuad Inc., Toronto, Canada
Date: Sat, 12 Sep 92 02:24:50 GMT

> > If I have a list in Bourne shell, how can I determine how many
> > elements are in, short of write a for loop and counting them?

I assume that "a list" means "a variable containing a number of items
delimited by spaces", so that "  a  b  "  and "a b" each have 2 elements.
Assuming that $list is the variable, then the simplest way is:

	listcount=`set dummy $list; shift; echo $#`

If you know that there's at least one element, you can omit the "dummy"
and the "shift;".  Otherwise those are necessary because of the way that
sh overloads the "set" command.  Of course, you don't need to assign
the result to a variable (listcount) unless you want to.

Someone else posts a long solution, which would also work if it did not
include the lines:

> echo "FIRST SAVE THE COMMAND LINE ARGUMENTS"
> args=$@
> ......
> echo "FINALLY, RESTORE THE COMMAND LINE ARGUMENTS"
> set $args

This fails badly if there was any whitespace in the command line arguments.
[And I do mean *was*. :-)]  The general approach can be made to work,
I guess, but it's a lot easier to just go into a subshell and change
the arguments in there.  And the `...` gives you the subshell.

-- 
Mark Brader			"The spaghetti is put there by the designer of
SoftQuad Inc., Toronto		 the code, not the designer of the language."
utzoo!sq!msb, msb@sq.com				-- Richard Minner

This article is in the public domain.
From: bfl@duke.cs.duke.edu (Brian Loss)
Newsgroups: comp.unix.shell
Subject: Re: Problem to alias
Date: 5 Sep 92 20:22:22 GMT
Organization: Duke University Computer Science Dept.; Durham, N.C.

In article <1992Sep5.144042.3171@leland.Stanford.EDU> peer@ccrma.stanford.edu (Peer Landa) writes:
>
>I have some problem to alias the following command:
>rsh remote_host dir/App -NXHost current_host&
>		
>
>In my .cshrc I tried to:
>alias  rshh  'rsh \!:1 \!:2 -NXHost hostname&'
> . but it doesn't work.  Any suggestions?
>
>-- peer

Try this:
alias rshh 'rsh \!:1 \!:2 -NXHost `hostname`&'
This should cause the result of the command hostname to be substituted (I am
assuming this is what you wanted to do.





Brian Loss
-- 
Department of Computer Science, Duke University, Durham, NC 27706
Internet:	bfl@cs.duke.edu
UUCP:		mcnc!duke!bfl
Newsgroups: comp.unix.shell
From: maupin@cs.washington.edu (Ken Maupin)
Subject: zsh function/positional parameter question...
Organization: University of Washington CSE Dept., Seattle, Washington
Distribution: usa
Date: Sun, 13 Sep 92 02:23:29 GMT

	I've been experimenting with zsh (I promise, I haven't
inhaled) and I've run across a slight tangle.  What I want to do in
zsh is accomplished as follows in (t)csh...

	alias var 'echo $\!^'

	In (t)csh, this alias, when called as 'var name', allows me to
get the value of the variable 'name' without typing 'echo $name'.  In
zsh, a function is required because of the argument -- however, the
following does not work...

	function var () { echo $$1 }

	This function prints the process id of my login shell (with a
'1' concatenated on the end) instead of the variable value of var's
argument.  No '\!^'-style notation seems to exist in zsh.  I've tried
quoting the dollar signs and enclosing things in parentheses,
brackets, and braces in attempts to separate the dollar signs.  I've
also scoured the zsh man page and intro.txt several times.
	Any suggestions are appreciated.  Please reply via email.
Thanks...

\-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-/
|                Kenneth Maupin +===+   o    +===+ "Playing in a band is as   |
|      maupin@cs.washington.edu |   |  /|\   |   |  close as four guys can    |
|      University of Washington |~~~|  Co--= |~~~|  get without having sex."  |
|   Computer Science Department |___|  / \   |___|     -- Dave Mustaine       |
/-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-\
From: smr@hitkw14.pki-nbg.philips.de (S.Riehm)
Newsgroups: comp.unix.shell
Subject: Re: Any known bugs for tcsh (6.02)
Date: 11 Sep 92 13:16:59 GMT

mjo@ef2007.efhd.ford.com (Mike O'Connor) writes:

>In article <smr.716033030@hitkw14> smr@hitkw14.pki-nbg.philips.de
>(S.Riehm) writes:

>:I have compiled up tcsh6.02 on hpux, and on our system we have a

>What version of HP-UX?  What architecture?

HP-UX 8.07 - on a HP 9000/710
I am aware that I don't have the latest version of tcsh though, but
getting an update from out in the internet backwaters is not proving
easy.. the only copy I got is in a corrupted uuencoded file.. great!

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

>If the sysadmins install the software for public use and parts of it
>are broken, it is their problem to a degree.

They didn't install it, they refuse to install it, so its a private
thing. The fact that half the developement team are now using tcsh
seems to have no impact on the sysadmins at all. So unfortunately it
is still my problem.

>:Hewlett Packard
>:	There is something wrong with tcsh.

>Sounds typical.  Find the one or two lines of code that cause a
>problem and report it to HP.  :)

... and then there was that time I found that other bug in HP's ....  :-)

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: ubacw00@ucl.ac.uk (Mick Farmer)
Newsgroups: comp.unix.shell
Subject: Re: How to do $#a in Bourne shell?
Date: 10 Sep 92 15:21:42 GMT
Organization: Bloomsbury Computing Consortium

Try something like:

	echo $a | wc -w

To capture the value:

	b=`echo $a | wc -w`

Regards,

Mick
From: hoepfner@usun01.UUCP (Andreas Hoepfner)
Newsgroups: comp.unix.shell
Subject: Re: How to empty a file
Date: 8 Sep 92 09:52:11 GMT
Organization: Nixdorf Computer AG, Paderborn, Germany

In <BtxIIn.ALK@world.std.com> geoff@world.std.com (Geoff Collyer) writes:

>Larry Gilmore:
>>When I had to ensure a zero-length file, I used:
>>
>>cat /dev/null > foofile

>What's wrong with ">file" (or ": >file" for you csh users)?
>-- 

Whats about 'cp /dev/null foofile'. Gives me the same result....


 +-----------------------------------------------------------------------+
 |                     Andreas Hoepfner                                  |
 |                                                                       |
 |     paper mail:                            e-mail:                    |
 | Siemens Nixdorf Informations                                          |
 |         Systeme                      USA:  hoepfner.kd@sni-usa.com    |
 | Abt. PU 2221                         !USA: hoepfner.kd@sni.de         |
 | Heinz Nixdorf Ring                                                    |
 | D-4790 Paderborn                                                      |
 | tel.: (+49) 5251 8-27479                                              |
 +-----------------------------------------------------------------------+

Newsgroups: comp.unix.shell
From: pdel@ADS.COM (Peter Delevoryas)
Subject: Simulating keyboard input in interactive programs
Organization: Advanced Decision Systems, Mtn. View, CA (415)960-7300
Distribution: usa
Date: Wed, 9 Sep 1992 04:55:25 GMT

Okay I've been reading for over two weeks, plus yesterday I caught up
on 500 articles, so I should be entitled to:  THE POST!!

Not only that, I have two (somewhat related) questions :


#1.
	How do you simulate a keypress in an interactive program
	which is within a script ? (If this is a FAQ I'm dead, I know.
	Oh well the public ridicule is worth the answer ).

	Example: (csh)

	% while ( 1 )
	> restore ivf /dev/tape
	> mt fsf 1
	> end

	Now upon execution of the restore, this will give me the
	partition name and dumpdate, which is what I want to see.
	Since it's interactive, it will wait for a prompt to tell
	it what to do next. All I want to do is get the script to
	type in a 'q' to make the restore quit so 'mt fsf' can go
	to the next filemark.


	I don't want to do 'restore t' because that won't give me
	the dumpdates and partition name.

	So how can I put the 'q' character in there at the right time?



#2
	This is kind of related to #1. Our dial-in lines are set to
	auto-log out after about 20 min. of inactivity. Short of
	programming the terminal-server not to do this, how can I
	keep a process going so that it always seems like I'm doing
	something, even if I'm in the kitchen making a BLT (extra mayo).
	Just starting up some kind of loop won't do it; it has to be
	equal to a keypress from MY keyboard.

	This probably belongs in unix.sys or some-such, but, since I'm
	here already..... okay, I'll cross-post.
	
	

thanks for help,  PD

--

 login name:   L1-A                      
 In real life: Peter Delevoryas
 In any other life: a cheap imitation
From: carlj@muppet.bt.co.uk (Carl Johnson)
Newsgroups: comp.unix.shell
Subject: Re: Shell types (May be FAQ)
Date: 9 Sep 92 17:03:47 GMT
Reply-To: carlj@muppet.bt.co.uk
Organization: British Telecom


In article laqdhjINN34i@jethro.Corp.Sun.COM, Eric.Arnold@Sun.COM (Eric arnold) writes:
=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:

<Lots of nice things about zsh>

I dont want to start a flame war here but this sounds very similar to tcsh,
why did you choose zsh over it in particular?

Cheers,
C
Newsgroups: comp.unix.shell
From: adrian@ibmpcug.co.uk (Adrian Hall)
Newsgroups: comp.unix.shell
Subject: Re: Automating telnet
Keywords: telnet, here documents, automatic login
Date: 7 Sep 92 10:22:37 GMT
Organization: The IBM PC User Group, UK.

In article <ellis.715831025@nova> ellis@nova.gmi.edu (Stew Ellis) 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. :(

I tend to use 'expect' for these sorts of tasks (they dont come along
that often). Check out your local archive site for the sources.

Adrian.

-- 
--------------------------------------------------------------------------
Adrian Hall					Connect Systems Manager
adrian@ibmpcug.co.uk				The IBM PC User Group
Tel: +44 81 863 1191				Harrow, London, UK
Newsgroups: comp.unix.shell,comp.sys.hp,comp.unix.sources
From: bsaunders@hns.com (Barrie Saunders)
Subject: Automated Conversion from KSH to CSH and vice versa
Keywords: CSH KSH CONVERSION
Organization: Hughes Network Systems Inc.
Distribution: usa,uk
Date: Thu, 10 Sep 1992 21:00:59 GMT

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

Does anyone known of any tools/scripts and the like that will
convert CSH scripts to KSH and KSH scripts to CSH?  
-- 
bsaunders (Barrie Saunders)