Created
September 15, 2022 01:29
-
-
Save demicuz/487b98066b4cf03d2337ff61d40ac6d6 to your computer and use it in GitHub Desktop.
Fish shell has `fish_add_path` to add directories to PATH. But doesn't have a remove function, so here it is.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Source: superuser.com/questions/776008 | |
function fish_remove_path --description "Remove paths from the PATH" | |
if set -l index (contains -i $argv[1] $PATH) | |
set --erase --universal fish_user_paths[$index] | |
echo "Updated PATH: $PATH" | |
else | |
echo "$argv[1] not found in PATH: $PATH" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment