Run program in a modified working directory.
$ wd /usr/bin pwd
/usr/bin
Put archive file in a custom directory across archivers:
$ wd ./dir tar cvaf ../dir.tbz2 .
$ wd ./dir zip -r ../dir .
$ wd ./dir 7z a ../dir . -tzip
Start a subshell:
$ wd /
$ echo $SHLVL $PWD
2 /
Run <command>
(which defaults to $SHELL
) with supplied arguments in a given working directory. Fall back to shell (just in case <command>
is a shell function or alias).
--shell
forces command to be executed in shell.
This is only a thin wrapper over kexec falling back to child_process.spawnSync, but anyway:
Synchronously spawn process defined by cmd
and argv
in the working directory wd
.
- wd
- Working directory to spawn process in.
- cmd
- Command to run.
- argv
- Array of arguments.
npm install -g cli-wd
MIT