Skip to content

Instantly share code, notes, and snippets.

@Hammer2900
Created December 22, 2022 09:17
Show Gist options
  • Save Hammer2900/2ecd2d95386b925af2680fcae863f08f to your computer and use it in GitHub Desktop.
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…
# 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