bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: export PWD


From: Andreas Schwab
Subject: Re: export PWD
Date: Thu, 04 Jul 2002 10:41:13 +0200
User-agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.3.50 (ia64-suse-linux)

address@hidden (J철rg Hohwiller) writes:

|> I have a script lets call it yyy that determines a special directory
|> depending on the arguments parsed. What I want is a way to have
|> a simple command that parses all its args to yyy and then cds to the
|> resulting directory of yyy.
|> Did not get it?
|> Example:
|> [~]# yyy gcc
|> /usr/src/Sources/gcc
|> [~]# cd /usr/src/Sources/gcc
|> [gcc]#
|> 
|> What I want is to have a command that does both commands above.
|> I read the damn long bash manpage and could not find a way for a
|> script to change the actual working directory (tried popd, etc.)
|> so my last chance was something with alias
|>   alias mycd='cd $(yyy $@)'
|> damn aliases are just a replacement of the command, so yyy does not
|> get any args if you call e.g. mycd gcc.

Use a shell function.

mycd () { cd $(yyy "$@"); }

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 N체rnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]