0

我需要一些帮助,因为我无法弄清楚错误。

read input    
echo -e "$input" | cut -c4-    
cd "$input" | cut -c4-

所以我输入cd test,回显输出是正确的test

我想更改目录,但它给出了cd cd test.

任何帮助表示赞赏。

4

1 回答 1

0

你想要的应该是:

cd $(echo -e "$input" | cut -c4-)

也可以像这样完成(参见 bash “here strings”)

cd $(cut -c4- <<<$input)
于 2012-08-31T09:57:58.987 回答