Created
December 9, 2016 20:14
-
-
Save colstrom/35a72b1c968337a9a66d9d7de028e009 to your computer and use it in GitHub Desktop.
with-cwd-as.fish: executes commands in another directory
This file contains hidden or 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
| 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 |
This file contains hidden or 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
| 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