击:如何删除我所有的TEXTFILES以#开头的? [英] Bash: How do I delete all my textfiles starting with #?
问题描述
我试过
RM -r#*
和
RM#*
但它只是输出这样的信息:
用法:RM [-f | -i] [-dPRrvW]文件...
取消链接文件
这是什么问题?
RM \\#*
应该为你做的伎俩。记住#得到了在shell特殊的意义,它开始的注释。
要引用
以#(用#!除外)开头的行是注释,
将不被执行。
也可能会出现一个命令结束后的评论。
块引用>&安培;
逃生[反斜线]。一个引用机制为单个字符。
\\点¯x转义字符X.这具有引用X的效果,
相当于X。所述\\可用于引用和',所以它们是
前$ P $字面上pssed。
块引用>要是你有文件
文件1
,文件2
&安培;文件3
,要删除它们就要使用:RM \\'文件*#注释:这将删除所有文件以'文件
参考: TLDP注意,特殊字符
I tried
rm -r #*
and
rm #*
But it just outputs this message: usage: rm [-f | -i] [-dPRrvW] file ... unlink file
What's the problem?
解决方案rm \#*
should do the trick for you. Remember # has got special meaning in the shell, it starts a comment.
To quote
Lines beginning with a # (with the exception of #!) are comments and will not be executed. Comments may also occur following the end of a command.
&
escape [backslash]. A quoting mechanism for single characters.
\X escapes the character X. This has the effect of "quoting" X, equivalent to 'X'. The \ may be used to quote " and ', so they are expressed literally.
Had you have files
'file1
,'file2
&'file3
, to delete them you would have used :rm \'file* #Comment : This deletes all the files starting with 'file
Reference:TLDP note on special characters
这篇关于击:如何删除我所有的TEXTFILES以#开头的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!