home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / bash / bug / 583 < prev    next >
Encoding:
Text File  |  1992-09-01  |  1.3 KB  |  51 lines

  1. Newsgroups: gnu.bash.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!odin.ins.cwru.edu!chet
  3. From: chet@odin.ins.cwru.edu (Chet Ramey)
  4. Subject: Re: alias
  5. Message-ID: <9209011436.AA16705.SM@odin.INS.CWRU.Edu>
  6. Sender: gnulists@ai.mit.edu
  7. Reply-To: chet@po.cwru.edu
  8. Organization: GNUs Not Usenet
  9. References: chet@odin.ins.cwru.edu (Chet Ramey)
  10. Distribution: gnu
  11. Date: Tue, 1 Sep 1992 06:36:06 GMT
  12. Approved: bug-bash@prep.ai.mit.edu
  13. Lines: 36
  14.  
  15. > How do you get, in an alias, the rest of the command line expanded?
  16. > If I write
  17. >     alias xx='echo abc 777 def'
  18. > and
  19. >     xx this is fun
  20. > should print
  21. >     abc this is fun def
  22. >
  23. > What do I need to write instead of the '777'? Could not find
  24. > anything in the documentation. It's a bug in that it's not documented .......
  25.  
  26. You cannot do what you want with aliases.  What you want to use
  27. are shell functions:
  28.  
  29. xx()
  30. {
  31.     echo abc $@ def
  32. }
  33.  
  34. As for it being documented, this text appears in the bash-1.12
  35. manual page, section ALIASES:
  36.  
  37.     There is no mechanism for using arguments in the
  38.     replacement text, a la csh.  If arguments are needed,
  39.     a shell function should be used.
  40.  
  41. Chet
  42.  
  43.  
  44.  
  45. --
  46. ``The use of history as therapy means the corruption of history as history.''
  47.     -- Arthur Schlesinger
  48.  
  49. Chet Ramey, Case Western Reserve University    Internet: chet@po.CWRU.Edu
  50.  
  51.