Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!kiwi!chet From: chet@kiwi.CWRU.EDU (Chet Ramey) Newsgroups: gnu.emacs Subject: Re: Bash question from a novice Message-ID: <547@cwjcc.CWRU.Edu> Date: 7 Sep 89 20:08:52 GMT References: <89250.114714T20@PSUVM.BITNET> Sender: news@cwjcc.CWRU.Edu Reply-To: chet@kiwi.CWRU.EDU (Chet Ramey) Organization: CWRU Andrew R. Jennings Computing Center Lines: 51 In article <89250.114714T20@PSUVM.BITNET> T20@PSUVM.BITNET (Stephen G. Simpson) writes: I'm not sure where on the net to turn for information about Bash, the GNU Bourne Again Shell, so I'll try here. If there is another newsgroup where Bash users hang out, please e-mail me. Try "gnu.bash.bug". However, I have some simple questions about aliasing in Bash. For example, I would like to do something like alias f='finger $* | more' so that f rms on the command line would be executed as finger rms | more Unfortunately this doesn't work. It seems that the only way is to use a function definition, function f () { finger $* | more ; } Or, is there a simpler way? Why is defining the above alias simpler than a function? Functions are the right way to do aliasing with arguments; aliases were always meant for simple textual substitution. In the C Shell, I can do it with alias f 'finger \!* | more' and in the DOS world, CED and 4DOS have a similar capability. Since Bash is supposed to include a superset of the useful features of the C Shell, I thought it ought to have this ability to pass arguments to aliases. Can someone clarify this? Shell functions are really a much more useful mechanism than csh-style aliases. See the 4.3 BSD csh man page, in the "BUGS" section. Chet Ramey Chet Ramey "We are preparing to think about contemplating Network Services Group, CWRU preliminary work on plans to develop a chet@cwjcc.INS.CWRU.Edu schedule for producing the 10th Edition of the Unix Programmers Manual." -- Andrew Hume