Is there any way to mark a script to be "run as source" so you don't have to add the source
or "." command to it every time? i.e., if I write a script called "sup", I'd like to call it as
sup Argument
rather than
source sup Argument
or
. sup Argument
Basically, I'm trying to use cd
within a script.
Bash forks and starts a subshell way before it or your kernel even considers what it's supposed to do in there. It's not something you can "undo". So no, it's impossible.
Thankfully.
Look into bash
functions instead:
sup() {
...
}
Put that in your ~/.bashrc
.