Re: bash: can I cd from a script
On Wed, 2003-07-23 at 07:36, David Z Maze wrote:
> Depending on how complicated the script is, rewriting it as a shell
> function might be appropriate. You could add to your .bashrc file
> something like
>
> cdls() { cd "$1"; ls; }
>
> and then "cdls foo" would change directories to foo and list it.
If your script is really complicated, alter it a bit so it prints out
the directory to change to and you can still do it as a function:
mycd() {
cd `my-big-script "$*"`
}
my-big-script:
#! /bin/sh
# Do lots of stuff
echo /the/new/directory
--
Dave Carrigan
Seattle, WA, USA
dave@rudedog.org | http://www.rudedog.org/ | ICQ:161669680
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-C++-DNS-PalmOS-PostgreSQL-MySQL
Reply to: