This topic created in 4527 days ago, the information mentioned may be changed or developed.
OS X下,如何在执行某个命令的时候指定一个特定的目录。
比如我想要我当前的命令在XXX目录下执行,但是我又不想cd过去。
2 replies • 2014-07-02 08:09:58 +08:00
 |
|
function under() { local dir=$1 shift local old_pwd="$PWD" cd "$dir" "$@" cd "$old_pwd" }
under / ls -l
这样?
|
 |
|
@ lululau 我一般是 cd /the/directory/ && ls -l && cd -
|