eecsseudl的个人空间 https://blog.eetop.cn/469850 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

在linux下删除含有dash的文件名

已有 1257 次阅读| 2013-3-12 22:25

在linux系统,如果出现一个文件名字以dash “-”开头,例如 -bashname,你怎样对起进行编辑活删除等处理呢?
使用双dash如实现,如:
删除这个文件,你可以使用命令: rm -- -basename
如果你想打开编辑这个文件,你可以使用命令: vim -- -basename

Filenames beginning with "-" may cause problems when coupled with the "-" redirection operator. A script. should check for this and add an appropriate prefix to such filenames, for example, ./-Filename. $PWD/-Filename, or $PATHNAME/-Filename

If the value of a variable begins with a "-", this may likewise create problems.
var="-n"
echo $var

# Has the effect of "echo -n", and outputs nothing.

点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 0

    粉丝
  • 0

    好友
  • 0

    获赞
  • 0

    评论
  • 1135

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-3-29 15:33 , Processed in 0.026865 second(s), 13 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部