cd script - Programming On Unix

Users browsing this thread: 1 Guest(s)
r4ndom
Members
(03-05-2017, 07:27 AM)venam Wrote: Maybe those two shell commands: `pushd` and `popd` might be useful for what you intend to do:
https://en.wikipedia.org/wiki/Pushd_and_popd
That's awesome. I should really dive into /usr/bin and search for these kind of treasures. But for this problem I will go with darthlukan's approach (explanation below).

(03-05-2017, 12:19 PM)darthlukan Wrote: Remove `exec bash` from the script and set an alias for your script that looks like: `alias uni=". script_name.sh"`. Note the "." in the alias, "." is an alias for `source` which imports code to the shell, because you need this code in your current shell, not in a new shell, which is what you're creating with your current script.
Thanks. I prefer this a little more over venam's suggestion because it does not change the `pushd`, `popd` stack, which might be in use otherwise (currelty not, because I first need to get used to these commands).


Messages In This Thread
cd script - by r4ndom - 03-05-2017, 06:35 AM
RE: cd script - by venam - 03-05-2017, 07:27 AM
RE: cd script - by darthlukan - 03-05-2017, 12:19 PM
RE: cd script - by r4ndom - 03-05-2017, 04:36 PM
RE: cd script - by venam - 04-05-2017, 12:08 AM
RE: cd script - by rocx - 04-05-2017, 12:46 PM
RE: cd script - by z3bra - 04-05-2017, 07:19 PM