cd script - Programming On Unix

Users browsing this thread: 1 Guest(s)
darthlukan
Members
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.

Here's a gist that shows you the concept without any cruft: https://gist.github.com/darthlukan/0af01...le-mycd-sh

Reference this Stack Overflow answer: https://unix.stackexchange.com/a/156394
Github: https://github.com/darthlukan
CRUX Ports: http://ports.brianctomlinson.com
GPG: 3694569D
"We're all human, act accordingly." -- Me


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