Created
December 22, 2022 09:17
-
-
Save Hammer2900/2ecd2d95386b925af2680fcae863f08f to your computer and use it in GitHub Desktop.
This will define an alias called find-and-activate that will search for directories within the current directory (.), and then check if each directory contains a file called activate.fish. If the file is found, the . command will be used to execute the file in the current shell. The return command will exit the alias once the first activate.fish…
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
# Define the function | |
function find-and-activate | |
for dir in (find . -type d) | |
if test -f $dir/activate.fish | |
. $dir/activate.fish | |
return | |
end | |
end | |
end | |
# Define the alias | |
alias find-and-activate='for dir in (find . -type d); and test -f $dir/activate.fish; and . $dir/activate.fish; and return; end' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment