我正在编写 shell 脚本:
read newcatalog
newcatalog=`'print -- $newcatalog | sed 's/^-/\.\/-/'`
cd "$newcatalog"
newcatalog 这是新目录的名称。目录名称应该支持 * ? 和任何选项。
目录名称中的“-n”“-y”和其他“-”工作正常,但*
不起作用,因为
print -- $newcatalog
方法
print -- * | sed 's/^-/\.\/-/'
它发送到sed
所有文件,但我只想发送*
,如下所示:
print -- "*" | sed 's/^-/\.\/-/'