如何从一个不同的目录运行Linux shell命令而不需要实际到达那里?如何从不同的目录运行Linux shell命令而不去那里?
在下面,我想运行一个make
命令,但并不进入源代码目录,即,从我的主目录:
[email protected]:~$ ~/my/source/code/directory/make #This is wrong!
我见过一些例子表明为:
[email protected]:~$ cd ~/my/source/code/directory; make
但是,这最终把我带入那个我想避免的源代码目录。
有可能的是另一种选择:
[email protected]:~$ cd ~/my/source/code/directory; make; cd ~
但它成为CESE复杂。
我想知道是否可以有比这些更好,更简单的方法吗?
可能的重复[如何使用不同的工作目录从当前的Linux shell运行程序?](http ://stackoverflow.com/questions/786376/how-do-i-run-a-program-with-a-different-working-directory-from-current-from-lin) – Madivad 2016-02-11 13:26:57
@Madivad,感谢您指点。要知道,[虽然不能这样做](http://meta.stackoverflow.com/questions/265736/should-i-delete-my-question-if-it-is-marked-as-a-duplicate)没有:| – tod 2016-02-11 15:52:58
这很酷,我不想让它消失,只是链接 – Madivad 2016-02-11 21:21:02