HDTenEightyP/NetNews huggingface dataset:
From: dkeber@news.weeg.uiowa.edu (David Keber)
Subject: GNU bash shell -- how to do csh alias things in bash functions
Keywords: bash csh shell alias functions GNU
Organization: University of Iowa - Weeg Computing Center
Date: Fri, 24 Jul 1992 19:58:40 GMT

I am switching over from the csh shell to the GNU bash shell, and am
having some troubles getting equivalent alias commands between the two.

Specifically, I have two directory related aliases in csh like this:

    alias dir='ls -aFglNqsT \!* | more'
    alias ls='ls -CFq \!* | more'

My understanding is that you cannot put command line arguments into
bash aliases (right?), so I wrote the following two bash functions:

    dir () { ls -aFglNqsT $1 | more ; }
    ls () { ls -CFq $1 | more ; }

based of the example of functions given in the man page (btw/why the
semicolon at the end?).  THESE FUNCTIONS DO NOT WORK.  If I rename
the ls function to foo, then they both end up working correctly!
Otherwise, I get some error message about fork processes.  Evidently,
bash doesn't like you "functioning" UNIX commands?  I want to do an
ls with the -CFq arguements almost all the time just by typing "ls".
Is this somehow not possible in bash?

Another question I had was in converting the following alias:

    alias whereis "find ~ -name '\!*' -print | more"

the function I wrote was:

    whereis() { find ~ -name $1 -print | more }

For some reason, this function won't work with the single quotes just
after the -name option and before the -print function (why?).  As it
is now, it just works unreliably.  In csh, this is supposed to give a
list of all files matching a specific pattern, for example

          whereis *.ps

would list the full pathname of any file that ended in ".ps".

This function in the bash shell, will only list one, or maybe more,
but usually not all of the files that end in ".ps".  Why not?

befuddled,
Dave                                               dkeber@umaxc.weeg.uiowa.edu



Newsgroups: comp.unix.shell
From: bdbryan@eng.clemson.edu (Ben Bryant)
Subject: simple csh question
Reply-To: bdbryan@eng.clemson.edu
Organization: College of Engineering, Clemson Univ.
Date: Tue, 28 Jul 1992 00:58:07 GMT

Does anyone know why the following shell code snippet for the csh keeps giving
me a "@: Expression syntax" error message? Code follows:

foreach record (`cat somefile`) # `somefile' contains simple ascii records. one number
                                # to a line.
  @ ybacc = $ybacc + ((($record - $bave) * ($record - $bave))/$bcount)
end

All the above variables are simple integer variables that have been previously
calculated. 

Any help would be most welcome. Thanks much.

-Benjamin Bryant
<bdbryan@eng.clemson.edu>

Keywords: 



Xref: sparky comp.unix.shell:3113 comp.unix.questions:9375
From: friedman@gnu.ai.mit.edu (Noah Friedman)
Newsgroups: comp.unix.shell,comp.unix.questions
Subject: Re: What's wrong with this sed command?
Date: 24 Jul 92 08:13:05 GMT
Followup-To: comp.unix.shell
Distribution: comp
Organization: Free Software Foundation, 675 Mass Ave. Cambridge, MA 02139
In-reply-to: montnaro@ausable.crd.ge.com's message of 21 Jul 92 21:03:21 GMT

In article <MONTNARO.92Jul21160321@ausable.crd.ge.com> montnaro@ausable.crd.ge.com (Skip Montanaro) writes:
>I'm trying to use sed to trim off all leading "./" patterns from source
>filenames in make rules. On an IBM RS6000 the following works as I expected:
>
>   echo 'enquire.o: ./././enquire.c' | sed 's?: \(\./\)\{1,\}?: ?'
>
>yielding
>
>   enquire.o: enquire.c

   It looks like you're trying to use some sort of extended regular
expression here to match a consecutive range of regexps (in this case,
starting with the first and going to the end).  I've never seen a version
of sed that implements this (including GNU sed).  The following does what
you wanted, however, and is quite portable:

   echo 'enquire.o: ./././enquire.c' | sed 's?: \(\./\)\1*?: ?'

The reason why this works should be obvious. 

>Have I incorrectly specified the sed command or are one (or more) of the
>vendors' sed implementations incorrect? If so, which one(s)? I'm inclined to
>believe the IBM is correct and the others are bugged.

   I don't know.  IBM may have made such an extension, but I'm not familiar
with it.  But a trivial modification to your example makes it work across
all the platforms you mentioned (I didn't bother quoting them in my reply).
Newsgroups: comp.unix.shell
From: dylan@ibmpcug.co.uk (Matthew Farwell)
Subject: Re: Sort problem . .
Organization: The IBM PC User Group, UK.
Date: Thu, 30 Jul 1992 07:17:44 GMT

In article <1992Jul29.191614.18102@news.eng.convex.com> tchrist@convex.COM (Tom Christiansen) writes:
>From the keyboard of messina@netcom.com (Tony Porczyk):
>:Seems to me like the simplest solution would be to change line 725 in ps.c
>:(maybe somewhere else in your source) from:
>:printf("%s COMMAND\n", hdr);
>:to:
>:fprintf(stderr, "%s COMMAND\n", hdr);
>:
>:and recompile it.
>
>*Never* hack source when a wrapper will do. And some (most?) people 
>don't even have source.

Of course, if you don't have source, you can always do it with adb :-)

Dylan.
-- 
It is no coincidence that in no known language does the phrase 'As
pretty as an Airport' appear -- Douglas Adams
Newsgroups: comp.unix.shell
From: Harald.Eikrem@delab.sintef.no
Subject: Re: tcsh in the future - what should it be like?
Organization: SINTEF DELAB, Trondheim, Norway.
	<1992Jul27.031238.10376@chpc.utexas.edu>
Date: 27 Jul 92 21:52:02

! I'd like to see a history mechanism that works like VMS' RECALL, i.e. 
! type something like !vi .cs  and get the last vi command that edits 
! .cshrc.  Simple, powerful concept; only a single command to learn. 

It's there.  You just need to try.

! Also, the history list should save a command only if it is different 
! from the last one.

No way.  You will be able to reach the next *different* command in the
command history by "history-search-backward", it skips back over all
similar commands.  You just need to bind it to a proper key that you think
you'll tend to use.  (Say, bind it to X11 "Prior" key if available, or
"PgUp" on a Sun keyboard).

! If both these questions have solutions already it only shows that tcsh 
! has too many features.  I can't remember them so I don't use them.

You have probably never made the attempt to find out.

   ~~harald E.
Newsgroups: comp.unix.shell,comp.unix.questions
From: glaze@cs.mu.oz.au (Glaze)
Subject: Re: What's wrong with this sed command?
Organization: Computer Science, University of Melbourne, Australia
Date: Thu, 23 Jul 1992 03:35:20 GMT

> I'm trying to use sed to trim off all leading "./" patterns from source
> filenames in make rules. On an IBM RS6000 the following works as I expected:

>    echo 'enquire.o: ./././enquire.c' | sed 's?: \(\./\)\{1,\}?: ?'
> yielding
>    enquire.o: enquire.c

> On our other systems (Sun-4, HP, SGI, and Motorola 68040) it prints
> different results. The HP doesn't trim any "./" patterns, while the Sun,
> Moto, and SGI all trim one pattern.

> Have I incorrectly specified the sed command or are one (or more) of the
> vendors' sed implementations incorrect? If so, which one(s)? I'm inclined to
> believe the IBM is correct and the others are bugged.

I'm inclined to believe the IBM is incorrect and most of the others are
correct. Your sed should be trying to match ONE pattern of the form
": ./"[blah]  and it does(on most machines) and replaces it. What you
want is for it to match multiple "./"s after the ": ", so try
    echo 'enquire.o: ./././enquire.c' | sed 's?: [\./]*?: ?'

> (I suppose this is another argument for perl...)
Could be.
Newsgroups: comp.unix.shell,comp.unix.questions
From: gopi@indetech.com (Prakash Gopinath)
Subject: Help! not able to connect to a remote system
Organization: Independence Technologies, Inc. Fremont, CA
Distribution: usa
Date: Wed, 29 Jul 1992 18:43:45 GMT


I am working on a Sun Sparc station (SLC). I want to logon to a VAX/VMS system. I have got the address of the remote system. I used telnet for connecting to the remote system. But it gives an error message "Network is unreachable". Is there any other way to connect to the remote system.
Please help.
       
Thanks in advance

Gopinath
Xref: sparky comp.unix.shell:3162 comp.sources.wanted:3770 alt.sources.wanted:1290 alt.usage.english:5572
From: chet@odin.INS.CWRU.Edu (Chet Ramey)
Subject: Re: file locking in shell scripts
Organization: Case Western Reserve University, Cleveland, OH (USA)
Date: Mon, 27 Jul 92 12:21:24 GMT

In article <FRIEDMAN.92Jul24055302@nutrimat.gnu.ai.mit.edu> friedman@gnu.ai.mit.edu (Noah Friedman) writes:

>suggest a patch to bash that will make the noclobber feature a little more
>reliable (it presently does a stat and then an open, which results in a
>race condition), and then it will be possible to do the following safely:

Race condition or no, the call to stat has to be in there.  Noclobber works
only for regular files, and this has to be checked before an open is
attempted.  Were this check not in there, you'd find that after setting
-o noclobber you'd no longer be able to redirect anything to /dev/null.

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: wayne@gbrmpa.gov.au (Wayne Amisano)
Subject: setting variable from script to current environment??
Organization: Great Barrier Reef Marine Park Authority
Date: Tue, 21 Jul 1992 07:02:12 GMT

Hi,

I am trying to write a script to set an environment variable in
my tcsh environment.  I could use an alias to do it, but would
much rather do it from a script.  What i need to do is, run a
script to change the value of one environment variable, but
every time i do this, it changes the variable in the spawned
process, but it then disappears when it dies.

I need this variable to remain around!!  Any ideas would be welcome.

tnx cul wayne!!


-- 
Wayne Amisano (VK4KT)     _-_|\\    E-Mail - wayne@gbrmpa.gov.au
Great Barrier Reef       /     \\   Phone  - +61 77 81 8861 (GMT+1000)
Marine Park Authority.   \_.-._/    Fax    - +61 77 72 6093
Our's to use Wisely!          v     Mail   - GPO Box 1379, Townsville QLD 4810
Newsgroups: comp.unix.shell
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: And the user cried, Features, features MORE featurs!
Originator: tchrist@pixel.convex.com
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: CONVEX Realtime Development, Colorado Springs, CO
Distribution: comp.unix.shell
Date: Wed, 29 Jul 1992 12:59:16 GMT
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 perl@dwrsun4.UUCP (Robert Perlberg):
:In article <QUANSTRO.92Jul24134625@lars.StOlaf.edu>, quanstro@lars.StOlaf.edu (goon) writes:
:>     modifiers), which is probablly why Bill Joy did not catch all the
:>     bugs (Read csh-whynot).
:
:What is this "csh-whynot" document you refer to and where can I get a
:copy?

convex.com:/pub/csh.whynot, or I'll mail it to you.

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

    "UNIX was not designed to stop you from doing stupid things, because
     that would also stop you from doing clever things." -- Doug Gwyn
Newsgroups: comp.unix.shell
From: navarra@casbah.acns.nwu.edu (John Navarra)
Subject: Re: file name completion for ksh?
Organization: Northwestern University, Evanston Illinois.
Distribution: na
Date: Sat, 25 Jul 1992 03:31:38 GMT

In article <FRIEDMAN.92Jul24042018@nutrimat.gnu.ai.mit.edu> friedman@gnu.ai.mit.edu (Noah Friedman) writes:
>   Ah yes, features.  What would we do without them?  Probably get more
>work done, instead of endlessly tweaking our environments to no useful end.

	Yes, there is an unusual paradox to 'features' vs lack of them.
On the one hand, you have zsh with features from hell which you can spend
an eternity setting to a level you are comfortable with; and on the other
is rc which you can spend an eternity writing scripts to establish 
'features' to a level you are comfortable with.
 	Or, you could just leave well enough alone and get back to work!

>
>   Features?  You need features like you need poison ivy. 

	Yeah, the more you scratch, the greater the itch. 

-tms

-- 
From the Lab of the MaD ScIenTiST:
					
navarra@casbah.acns.nwu.edu
From: jerry@incc.com (Jerry Rocteur)
Newsgroups: comp.unix.shell
Subject: Re: Sort problem . .
Summary: Is it UNIX
Date: 29 Jul 92 17:54:53 GMT
Organization: InCC.com Perwez Belgium

In article <1992Jul29.072924*Harald.Eikrem@delab.sintef.no>, Harald.Eikrem@delab.sintef.no writes:
> From the clipboard of tchrist@convex.COM (Tom Christiansen):
> ! :Yeah, nice for {,k,z,ba}sh.  Why not simply
> ! :
> ! :        ps aux | ( line; sort -rn +3 )
> ! 
> ! line: Command not found.

     Standards Conformance
          line is conformant with:

          AT&T SVID Issue 2, Select Code 307-127;
          and The X/Open Portability Guide II of January 1987.

     (printed 8/28/89)               			LINE(C)

     from SCO ODT 1.1 man line

-- 
 __^__                                                              __^__
( ___ )------------------------------------------------------------( ___ )
 | / | Jerry Rocteur                       Email: jerry@InCC.COM    | \ |
 | / |             Independent Computer Consultants                 | \ |
 | / |--------------------------------------------------------------| \ |
 | / | This week's quote:                                           | \ |
 |___|           I think; therefore, I am confused.......           |___|
(_____)------------------------------------------------------------(_____)
   ^                                                                  ^
Newsgroups: comp.unix.shell
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: How to compile a shell script?
Originator: tchrist@pixel.convex.com
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: CONVEX Realtime Development, Colorado Springs, CO
Date: Thu, 23 Jul 1992 03:43:03 GMT
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 chung@cis.ohio-state.edu (Michael Chung):
:	Is there any way I can compile a shell script file so that it can
:run faster?

Not significantly.  The problem is that even if you compile something 
like:

    while read line; do
	echo `echo $line | tr ' ' '\12' | sort -n | tr '\12' ' '`
    done

It's still too damn slow.  You have to grok the logic and 
rewrite.  It needs a human.

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

BASIC: A programming language.  Related to certain social diseases in
that those who have it will not admit it in polite company.
Newsgroups: comp.unix.shell
From: chet@odin.INS.CWRU.Edu (Chet Ramey)
Subject: Re: GNU bash shell -- how to do csh alias things in bash functions
Keywords: bash csh shell alias functions GNU
Organization: Case Western Reserve University, Cleveland, OH (USA)
Date: Fri, 24 Jul 92 20:45:57 GMT

In article <1992Jul24.195840.11711@news.weeg.uiowa.edu> dkeber@news.weeg.uiowa.edu (David Keber) writes:
>
>My understanding is that you cannot put command line arguments into
>bash aliases (right?), so I wrote the following two bash functions:
>
>    dir () { ls -aFglNqsT $1 | more ; }
>    ls () { ls -CFq $1 | more ; }
>
>based of the example of functions given in the man page (btw/why the
>semicolon at the end?).  THESE FUNCTIONS DO NOT WORK.  If I rename
>the ls function to foo, then they both end up working correctly!

You've just written two infinitely recursive functions.  Aren't you
proud ;-)

Functions are looked up before other commands, builtin and file system.
Each time you call `ls', it finds the function, executes the body, finds
that the first command is `ls', finds the function, ...

What you want to do is something like this:

dir() { command ls -aFglNqsT $1 | more ; }
ls() { command ls -CFq $1 | more ; }

The `command' builtin executes its arguments as a command and arguments
without including shell functions in the command search sequence.

>I want to do an
>ls with the -CFq arguements almost all the time just by typing "ls".

Another thing you can do is

alias ls="ls -CFq"

and let the rest of the tokens on the line alone.  Bash takes special
pains to avoid infinite recursion when expanding aliases.

>Another question I had was in converting the following alias:
>
>    alias whereis "find ~ -name '\!*' -print | more"
>
>the function I wrote was:
>
>    whereis() { find ~ -name $1 -print | more }

This works fine for me.  You can't enclose the `$1' in single quotes
because this has the effect of inhibiting the expansion of $1, as
single quotes are supposed to.

>is now, it just works unreliably.  In csh, this is supposed to give a
>list of all files matching a specific pattern, for example
>
>          whereis *.ps
>
>would list the full pathname of any file that ended in ".ps".

"whereis '*.ps'" works fine for me.  Without the single quotes, globbing
(pathname expansion) is performed before the function is called.  If you
have files in the current directory ending with .ps, they become the
results of the expansion and are passed to `whereis' as arguments.  If you
happen to be in a directory with no ps files, the pattern is left unchanged
and things work as you expect. 

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: aswx266@chpc.utexas.edu (Michael Lemke)
Subject: Re: tcsh in the future - what should it be like?
Keywords: tcsh
Organization: The University of Texas System - CHPC
Distribution: comp.unix.shell
Date: Mon, 27 Jul 92 03:12:38 GMT

In article <1992Jul16.153506.24366@bmerh85.bnr.ca> sjane@bmers248.bnr.ca (sjs) writes:
>In article <yeates.711122638@beryl17> yeates@rtsg.mot.com (Tony J Yeates) writes:
>>I thought it might be interesting to make suggestions for future
>>enhancements to tcsh.  
>>
>>e.g. type "vi " then hit a "choosen key" (up arrow is already taken) to 
>>scroll thro'
>>(only) the previous vi commands.
>
>This function is already available.  It is called history-search-backward.
>You can bind it to a function key as I have bound it to F7  on my Sun:
>
>bindkey ^[[230z history-search-backward
>
>History-search-forward is also available in case you go too far too fast
>with history-search-backward.

I'd like to see a history mechanism that works like VMS' RECALL, i.e. 
type something like !vi .cs  and get the last vi command that edits 
.cshrc.  Simple, powerful concept; only a single command to learn. 

Also, the history list should save a command only if it is different 
from the last one.

If both these questions have solutions already it only shows that tcsh 
has too many features.  I can't remember them so I don't use them.
-- 
Michael Lemke
Astronomy, UT Austin, Texas
(michael@io.as.utexas.edu or UTSPAN::UTADNX::IO::MICHAEL [SPAN])
Newsgroups: comp.unix.shell
From: d-lewart@uiuc.edu (Daniel S. Lewart)
Subject: Re: sh equivalent of csh's `source` wanted
Originator: dslg0849@uxa.cso.uiuc.edu
Reply-To: d-lewart@uiuc.edu (Daniel S. Lewart)
Organization: University of Illinois at Urbana
Date: Fri, 31 Jul 1992 11:10:29 GMT
Keywords: help

ericw@hobbes.amd.com (Eric Wedaa) writes:

> HELP!!!  One of my users needs the Bourne Shell equivalent of csh's
> `source` command.  I don't think this is possible?  Any suggestions?

.

Daniel Lewart
d-lewart@uiuc.edu
Newsgroups: comp.unix.shell
From: dattier@ddsw1.mcs.com (David W. Tamkin)
Subject: Re: Sort problem . .
Organization: Contributor Account at ddsw1, Chicago, Illinois  60657
Date: Mon, 27 Jul 1992 15:43:36 GMT
X-Disclaimer:  Material posted in this article is the sole responsibility of
                the poster and does not represent MCSNet or the system owners.

peer@ccrma.stanford.edu (Peer Landa) wrote in
<1992Jul27.123415.977@leland.Stanford.EDU>:

| I'm trying to list & sort all my processes by memory use:
| alias  pss  ' ps uax | sort -nr +3'
| It works fine except for that the "title line" also gets sorted and
| therefore appears at the bottom . . any idea to avoid this ?

If you don't mind having yet an extra process in the alias, insert
'tail +2' into the pipeline betwen the ps and the sort.

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: boyd@prl.dec.com (Boyd Roberts)
Subject: Re: Sort problem . .
Organization: Digital Equipment Corporation - Paris Research Laboratory
Date: Tue, 28 Jul 1992 09:54:15 GMT

In article <1992Jul27.140110.846@news.eng.convex.com>, Tom Christiansen <tchrist@convex.COM> writes:
> 
> ps axu | ( sed 1q ; sort -nr +3 ) 
> 

Eh?  Since when does sed do `unbuffered' reads?

    prl313 ; @{echo 1 ; echo 2 ; echo 3} | @{sed 1q ; cat}
    1

Nice idea though...


Boyd Roberts			boyd@prl.dec.com

``When the going gets wierd, the weird turn pro...''
Newsgroups: comp.unix.shell
From: Harald.Eikrem@delab.sintef.no
Subject: Re: sh equivalent of csh's `source` wanted
Organization: SINTEF DELAB, Trondheim, Norway.
	<1992Jul31.123358.795@usenet.ins.cwru.edu> <Bs931H.Dpv@news.cso.uiuc.edu>
Date: 31 Jul 92 16:25:04

Anybody ever wondered about the csh (or better tcsh) equivalent of the Bourne
shell `.' ?  Although I will not recommend its usage, this works:

# a 'source' command that scans $path for files with execute access, which
# may fail desperately if the file isn't in a csh "sourceable" state:
alias psource 'if "\!*" == "" eval "echo -n p; source"; set _f=(`which \!*`); if $#_f == 1 source "$_f"; if $#_f != 1 echo psource: "\!*": Command not found.; unset _f'

# a 'source' command that first looks for a direct path to the file to be
# sourced, then tries $path:
alias . 'if "\!*" == "" source; if -f "\!*" source "\!*"; if ! -f "\!*" eval "psource \!*"'

   :)  ~~harald E.
From: Harald.Eikrem@delab.sintef.no
Newsgroups: comp.unix.shell
Date: 17 Jul 92 19:50 MDT
Subject: Re: Is it all digits?
Nf-ID: #R:81-m0xl@lynx.unm.edu:1101914314:1992Jul17.195016*Harald.Eikrem@d:833282682:001:384
Nf-From: delab.sintef.no!Harald.Eikrem    Jul 17 19:50:00 1992


boyd@prl.dec.com (Boyd Roberts) on this everlasting c-shell debate:
! > 
! >   set ans = $<
! >   if ( "$ans" =~ [0-9]* ) echo The answer contains digits
! >
! 
! Right it _contains_ digits, but the poster wanted:
! 
!     [...] if the input string is -ALL- digits :

I think I answered to that later on, the stuff about negating the contents
of brackets [], remember?

  ~~harald E.

Newsgroups: comp.unix.shell
From: Tom Christiansen <tchrist@convex.COM>
Subject: Re: Sort problem . .
Originator: tchrist@pixel.convex.com
Reply-To: tchrist@convex.COM (Tom Christiansen)
Organization: CONVEX Realtime Development, Colorado Springs, CO
Date: Tue, 28 Jul 1992 21:18:16 GMT
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 Harald.Eikrem@delab.sintef.no:
:! This does seem to work:
:! 
:! 	ps axu | (read line; echo "$line"; sort +3rn) 
:
:Yeah, nice for {,k,z,ba}sh.  Why not simply
:
:        ps aux | ( line; sort -rn +3 )

line: Command not found.

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist
    If you have ever seen the grim word "login:" on a screen, your mind
    is now a wholly-owned subsidiary of The Death Star.
                John Woods in <14105@ksr.com> of comp.unix.bsd
Newsgroups: comp.unix.shell