Article View: comp.unix.shell
Article #143GNU bash shell -- how to do csh alias things in bash functions
From: David Keber
Date: Fri, 24 Jul 1992 19:58
Date: Fri, 24 Jul 1992 19:58
44 lines
2184 bytes
2184 bytes
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
Technical Details
Message-ID:
<1992Jul24.195840.11711@news.weeg.uiowa.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!news.uiowa.edu!news.weeg.uiowa.edu!dkeberShow Full Headers
Complete Article Headers
Newsgroups: comp.unix.shell Path: arc1-ca.pugleaf.net!sparky!uunet!news.uiowa.edu!news.weeg.uiowa.edu!dkeber From: dkeber@news.weeg.uiowa.edu (David Keber) Subject: GNU bash shell -- how to do csh alias things in bash functions Message-ID: <1992Jul24.195840.11711@news.weeg.uiowa.edu> Keywords: bash csh shell alias functions GNU Organization: University of Iowa - Weeg Computing Center Date: Fri, 24 Jul 1992 19:58:40 GMT Lines: 47