Skip to content

Instantly share code, notes, and snippets.

@drewthorp
Created November 3, 2014 13:15
Show Gist options
  • Select an option

  • Save drewthorp/dbb7b6652a8b55b8db3a to your computer and use it in GitHub Desktop.

Select an option

Save drewthorp/dbb7b6652a8b55b8db3a to your computer and use it in GitHub Desktop.
Fish shell function that runs either a script or set of commands upon entering a directory. This function requires my change of directory event (https://gist.github.com/drewthorp/d8e5d888be72244b8d8a), and as with as event capturing function (It seems) cannot be autoloading. The script .fs_script will be executed upon entering its containing dir…
function fs_runscript -e directory_changed
if test -f "./.fs_script"
eval ("./.fs_script")
end
if test -f "./.fs_cmd"
# read file and run contents
set -l fs_cmd (cat ./.fs_cmd)
eval $fs_cmd
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment