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

  1. Newsgroups: gnu.bash.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!wdl1.wdl.loral.com!mdm
  3. From: mdm@wdl1.wdl.loral.com (Mike D Marchionna)
  4. Subject: Re: alias
  5. Message-ID: <1992Sep2.000915.16261@wdl.loral.com>
  6. Keywords: alias
  7. Sender: gnulists@ai.mit.edu
  8. Organization: Loral Western Development Labs
  9. References: <19390@ector.cs.purdue.edu>
  10. Distribution: gnu
  11. Date: Wed, 2 Sep 1992 00:09:15 GMT
  12. Approved: bug-bash@prep.ai.mit.edu
  13. Lines: 43
  14.  
  15. svb@cs.purdue.edu (Stephan Bechtolsheim) writes:
  16.  
  17. >How do you get, in an alias, the rest of the command line expanded?
  18. >If I write
  19. >    alias xx='echo abc 777 def'
  20. >and
  21. >    xx this is fun
  22. >should print
  23. >    abc this is fun def
  24.  
  25. >What do I need to write instead of the '777'? Could not find
  26. >anything in the documentation. It's a bug in that it's not documented .......
  27. >Verson 1.12.....
  28.  
  29. Well I'm having similar difficulty with version 1.10.  I know I can get
  30. the above example to work by using a function instead.  For example
  31.  
  32. function xx () { echo abc $1 def };
  33.  
  34. But if I try to declare a environment variable within the function, the
  35. variable vanishes after the function completes.  This is contrary to the
  36. statement that functions execute each line within the same shell.  For
  37. example if try to declare a function to simplify setting by X-Windows
  38. DISPLAY variable like so:
  39.  
  40. function xdsp () { declare -x DISPLAY=$1:0.0 }
  41.  
  42. This happens:
  43.  
  44. declare -x DISPLAY=foo
  45. xdsp lumpy
  46. echo $DISPLAY
  47. foo
  48.  
  49. Any ideas, or is this just a feature of Bash?
  50.  
  51. --MDM
  52. -- 
  53.  _________________________________________________________________________ 
  54. (  _______________________________   Brain, and brain!  What is brain!    ) 
  55.  \________________________________)        --Star Trek (Spock's Brain)   /
  56. El_Rayo_X_______________________________________________________________/ 
  57.  
  58.