在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 2513|回复: 3

[求助] linux脚本语法问题

[复制链接]
发表于 2017-2-4 10:21:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
最近看了一cshell脚本,里面有这样一句话,请问:q表示什么意思?如果去掉:q会怎么样?希望大神帮忙看看,多谢~
set cmd = "$ANCHOR_p4_mkwa/p4_mkwa.pl $*:q"
$cmd
发表于 2017-2-4 12:20:10 | 显示全部楼层
去掉了:q的话cshell会试图对?*之类的特殊字符做匹配处理,而不知把这些字符作为参数传给
cmd中的perl脚本。



http://www.grymoire.com/Unix/Csh.html

:q - Quote modifier
The C shell and Bourne shell behave differently whena filename pattern is used, and nothing matches.Suppose you have a shell script, named"test_me," that says# The test_me script, either sh or csh
echo $1

and you call it using:test_me ?

The Bourne shell will echo"?" which the C shell will report"echo: No match." You can disable this error by setting the nonomatch variable:#!/bin/csh -f
set nonomatch
echo $1

The other way to do this is to use the":q" modifier, which quotes the variable:#!/bin/csh -f
echo $1:q

 楼主| 发表于 2017-2-7 15:41:32 | 显示全部楼层
回复 2# jfxing


   非常感谢,还有你提供的网址,对学习csh很有帮助
发表于 2018-1-18 19:42:04 | 显示全部楼层
學習了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

GMT+8, 2024-3-29 00:35 , Processed in 0.027845 second(s), 6 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表