Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐: 强烈推荐:Ylmf OS 3.0 正式版发布附迅雷高 XP系统下硬盘安装Fedora 14图文教程
搜索:
您的位置: Linux安全网 > Linux入门 > » 正文

shell中的引用

来源: 未知 分享至:
shell中的引号
1.双引号
  $,`,\,保留特殊意义
  注意echo不加参数默认不支持\n这种转义字符
  printf支持
  [root@Centos5 test]# echo "\n"
  \n
  [root@Centos5 test]#
  [root@Centos5 test]# printf "\n"

  [root@Centos5 test]#
 注意在双引号中引用特殊字符echo "\特殊字符"
 #双引号中已知特殊字符$`\"四个
  echo "\""
  "
  echo "\$"
  $
2.单引号
  引用的字符解释为字符表面意思 
  注意echo -e时不论是单引号还是双引号中都会解释\n等转义字符
  转义字符表
  \\ \a \b \c \f \n \t \r \v
  # 不要和\$混淆
  [root@Centos5 test]# echo -e "\n"

  [root@Centos5 test]#
  [root@Centos5 test]# echo -e '\n'

  [root@Centos5 test]# echo -e '\"'
  \"
  再有
  [root@Centos5 test]# echo -e '\'
  \
  [root@Centos5 test]# echo -e '\\'
  \
  [root@Centos5 test]# echo \
  >
 不要迷惑哦
3.统配符号
  不要引起来用*?[]|^,如果匹配不到则解释为自身
 
  [root@Centos5 test]# ls *.111
  ls: *.111: No such file or directory
4.转义\,\后面紧接的字符解释为字面意思
  echo \*
  *
  echo \\
  \
5.shell元字符meta
  IFS
  CR
  =
  $
  >
  <|&(){};&&||!
  #这些字符不被引用时需要转义
  echo \=
  =
 有些输出我也不知道那就试试了反正就几次结果就出来了

Tags:
分享至:
最新图文资讯
1 2 3 4 5 6
验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史