当前位置: 技术问答>linux和unix
帮忙看看这个shell脚本,用正则匹配字符串为什么匹配不上
来源: 互联网 发布时间:2017-03-18
本文导语: #!/bin/bash das="dddd" if [[ $das = [d]{4} ]] then echo "what" else echo "no what" fi 输出为no what | #!/bin/bash das="dddd" if [[ $das = [d]{4} ]] then echo "what" else echo "no what" fi | ...
#!/bin/bash
das="dddd"
if [[ $das = [d]{4} ]]
then
echo "what"
else
echo "no what"
fi
输出为no what
das="dddd"
if [[ $das = [d]{4} ]]
then
echo "what"
else
echo "no what"
fi
输出为no what
|
#!/bin/bash
das="dddd"
if [[ $das = [d]{4} ]]
then
echo "what"
else
echo "no what"
fi
|
贴错了。。。
#!/bin/bash
das="dddd"
if [[ $das =~ [d]{4} ]]
then
echo "what"
else
echo "no what"
fi
看红色部分。
#!/bin/bash
das="dddd"
if [[ $das =~ [d]{4} ]]
then
echo "what"
else
echo "no what"
fi
看红色部分。