如何将which
命令的结果传输到cd
?
这就是我想做的:
which oracle | cd
cd < which oracle
但它们都不起作用.
有没有办法做到这一点(当然不是复制/粘贴)?
Edit : on second thought, this command would fail, because the destination file is NOT a folder/directory
因此,我现在正在思考并想出一种更好的方法来摆脱尾随的"/oracle"部分(sed或awk,甚至Perl):)
Edit : Okay that's what I've got in the end:
cd `which oracle | sed 's/\/oracle//g'`