例如,我有一个目录:/ full / path / to / your / dir,其中包含以下文件:
$ls /full/path/to/your/dir
/full/path/to/your/dir/test.1.log.gz
/full/path/to/your/dir/test.2.log.gz
/full/path/to/your/dir/test.3.log.gz
如果我直接在目标主机上运行cmd,它将打印结果而不会出现错误:
$ls /full/path/to/your/dir/test.!(3).log*
/full/path/to/your/dir/test.1.log.gz
/full/path/to/your/dir/test.2.log.gz
但如果我通过ssh在另一台主机上运行到目标主机执行,例如:
$ssh myself@hostname "ls /full/path/to/your/dir/test.!(3).log*"
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `ls /full/path/to/your/dir/test.!(3).log*'
另外,我试过以下:
$ssh myself@hostname "ls /full/path/to/your/dir/test.'!(3)'.log*"
ls: /full/path/to/your/dir/test.!(3).log*: No such file or directory
任何人都可以帮忙告诉如何更正cmd吗?