Skip to content

Instantly share code, notes, and snippets.

@colstrom
Created December 9, 2016 20:14
Show Gist options
  • Select an option

  • Save colstrom/35a72b1c968337a9a66d9d7de028e009 to your computer and use it in GitHub Desktop.

Select an option

Save colstrom/35a72b1c968337a9a66d9d7de028e009 to your computer and use it in GitHub Desktop.
with-cwd-as.fish: executes commands in another directory
name = with-cwd-as
author = Chris Olstrom
license = MIT
provides = fish/functions/with-cwd-as
requires
fish/builtin/and
fish/builtin/cd
fish/builtin/end
fish/builtin/function
fish/builtin/pwd
fish/builtin/set
fish/functions/eval
function with-cwd-as --argument dir
set owd (pwd)
set --erase argv[1]
cd "$dir"
and eval $argv
cd "$owd"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment