击:如何删除我所有的TEXTFILES以#开头的? [英] Bash: How do I delete all my textfiles starting with #?

查看:150
本文介绍了击:如何删除我所有的TEXTFILES以#开头的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试过

  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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆