bash脚本中的一些特殊字符的用法



#sigle double inverse quotes
echo "The use of sigle quotes:"
#connect the string, escape the space
echo 'hello world'
#ingore special character such as '\' '$'
echo '$0, will not show the script filename'


echo
echo "The use of double quotes:"
#show the meaning of the special character
echo "$0, will show the script filename"


echo
echo "The use of inverse quotes:"
#"Replace the command with the output" 
echo `date`


#the use of wildcard() and metachar
echo "The use of wildcard:"
# *means any,? means one char, [abc]means any one of abc, [!abc] any one but abc, {str1,str2} any one of str1 or str2
ls f*
ls f?le


echo "The use of metachar:"
# the metachar always be used in regex.
#such as ^ means the head of line, $ means the end of line, . means onechar, * meas any chars, x\{m\} meas char x exists in m places 
ls grep[^a-z]
ls grep[1-9$]


#the use of brace and parentheses
echo "The use of brace:"
#To split variable and other characters to get true value
name="123"
echo $namehello
echo ${name}hello


echo "The use of parentheses:"
#the same as inverse quotes
echo "Now is:" $(date) 
#use as to initial array and command array


echo "The use of semicolon:"
#use to contain two command in one line
echo $PWD;echo $PATH
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值