GiselleSerate / myaliases

Useful shell aliases and functions.
6 stars 1 forks source link

uninstall script doesn't work on zsh #27

Closed GiselleSerate closed 6 years ago

GiselleSerate commented 6 years ago

For some reason the $ABSPATH variable isn't being set in the .included. So this is a more fundamental problem found in the setup file.

GiselleSerate commented 6 years ago

Testing reveals that this is not a problem with the setup file. Echoing and saving $ABSPATH at the beginning of the uninstall script doesn't work for some reason; its value is blank there too. I don't know why this is; it worked fine on bash.

This is something that I can reacquire easily in the uninstall script, but this is a heads up that cds may not be able to use my established global variable in other bits of this repository.

aryarm commented 6 years ago

I might have an idea for why this is happening.

When we create the $ABSPATH variable, we are making it globally accessible (and editable) by all commands that are run after the terminal has started up. This includes our own commands like cds and whatnot. But an executed script (like uninstall, for example) may or may not have access to those global variables because we don't know whether it is being executed in the same environment as the one that set those global variables to begin with. This makes most sense when you realize that uninstall is being executed by /bin/sh, not /bin/zsh. This might explain why uninstall worked in a bash environment, since many terminals apparently use /bin/sh as bash.

This is all to say that cds shouldn't be affected, so we don't need to sweat it.