thi*_*khy 2 unix linux shell file
我试图通过简单地发出"cp*/dst_dir"来复制目录下的所有文件,但Shell显示:
~/git$ cp * ~/dst_dir
cp: invalid option -- 'o'
Run Code Online (Sandbox Code Playgroud)
然后发出"ls -1"列出所有文件,发现罪魁祸首是一些带有前缀' - '的文件,如下所示.
-count
-sdds
...
Run Code Online (Sandbox Code Playgroud)
不知道这些文件是如何生成的,而且我还是找不到删除或移动这些"-xxx"文件的方法.
~/git$ rm "-count"
rm: invalid option -- 'c'
Try `rm ./-count' to remove the file `-count'.
Try `rm --help' for more information.
~/git]$ mv \-count /tmp
mv: invalid option -- 'c'
Try `mv --help' for more information.
Run Code Online (Sandbox Code Playgroud)
顺便说一句,我的shell是RHEL 6.3上的TCSH,"tcsh --version"显示:
~/git]$ tcsh --version
tcsh --version
tcsh 6.17.00 (Astron) 2009-07-10 (x86_64-unknown-linux) options wide,nls,dl,al,kan,rh,color,filec
Run Code Online (Sandbox Code Playgroud)
任何人都有任何关于这个问题的线索.非常感谢您的帮助.
谢谢大家.我刚检查手册,发现以下官方答案:
To remove a file whose name starts with a '-', for example '-foo',
use one of these commands:
rm -- -foo
rm ./-foo
Run Code Online (Sandbox Code Playgroud)