T20@PSUVM.BITNET (Stephen G. Simpson) (09/07/89)
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. I am used to DOS where there are all kinds of public domain utilities to enhance the command line. In particular, there is a little item called DOSEDIT which allows you to recall and edit previous commands in a very intuitive way. You use up arrow to scroll back through previous commands, then when you find the one you want, you edit it using the left and right arrow, home, end, delete and insert keys. There is also a more elaborate program called 4DOS which replaces the normal DOS shell, COMMAND.COM. 4DOS incorporates DOSEDIT-style command line editing, aliasing, command completion, and a lot of other enhancements. An older program which does a lot of the same things is Chris Dunford's CED. In trying to get used to Unix, I found that C-shell command line editing is not nearly so flexible or easy to use. Wanting something better, I have been playing around with Bash for the last couple of days. Bash gives me pretty much what I was looking for. I have to use Ctrl-P instead of the up arrow, but that's OK since I am going to have to learn emacs anyway. 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? 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?
chet@kiwi.CWRU.EDU (Chet Ramey) (09/08/89)
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