|
|||||||||||
|
Re: [OT] Using aliases or functions in bash script
From: Daniel Dickinson <cshore(at)wightman.ca>
Date: Sat Jan 26 2008 - 17:19:04 EST
> On Sat, 26 Jan 2008 13:32:57 -0800, Andrew Sackville-West wrote: Ok, here's a question (as I missed the very first message): what are you trying to accomplish? If you just want to use functions that are in .bashrc in some other script then you can define the function in .bashrc and then source ~/.bashrc so, .bashrc has:
...
pushd +$1
and other-script.sh has #!/bin/bash source ~/.bashrc
pwd
That will execute function dt (which is a pushd) with the current working directory, the function dt being the one which was defined in .bashrc Now, for the alias you could define a function that does whatever it is want the alias to do, then create an alias that executes the function. Then in other-script.sh you either recreate the alias (if for some reason you really have to have an alias), or you can execute the function as with dt. If there is more to it than that you need to try doing your OP over again, only stating your problem more clearly. Regards, Daniel -- And that's my crabbing done for the day. Got it out of the way early, now I have the rest of the afternoon to sniff fragrant tea-roses or strangle cute bunnies or something. -- Michael Devore GnuPG Key Fingerprint 86 F5 81 A5 D4 2E 1F 1C http://gnupg.org No more sea shells: Daniel's Weblog http://cshore.wordpress.com -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
This archive was generated by hypermail 2.1.8 : Thu Mar 06 2008 - 14:14:52 EST |
||||||||||
|
|||||||||||