當前位置:首頁 » 編程軟體 » shell腳本通配符

shell腳本通配符

發布時間: 2025-01-25 13:30:03

㈠ shell腳本判斷字元串是否包含某個字元

方法一:利用grep查找
strA="long string"strB="string"result=$(echo $strA | grep "${strB}")if [[ "$result" != "" ]]then echo "包含"else echo "不包含"fi

方法二:利用字元串運算符 《linux就該這么學》 一起學習linux
strA="helloworld"strB="low"if [[ $strA =~ $strB ]]then echo "包含"else echo "不包含"fi
方法三:利用通配符
A="helloworld"B="low"if [[ $A == *$B* ]]then echo "包含"else echo "不包含"fi

熱點內容
安卓系統2K哪裡下載 發布:2025-03-06 21:14:04 瀏覽:942
如何在雲主機上搭建web伺服器 發布:2025-03-06 21:09:05 瀏覽:587
電腦改為伺服器有什麼用 發布:2025-03-06 21:00:38 瀏覽:270
網站在文件夾 發布:2025-03-06 20:51:46 瀏覽:116
阿瑪尼行李箱密碼鎖如何換密碼 發布:2025-03-06 20:46:02 瀏覽:106
xp共享文件夾win7無法訪問 發布:2025-03-06 20:35:40 瀏覽:589
oracle存儲過程excel 發布:2025-03-06 20:35:10 瀏覽:891
lay源碼 發布:2025-03-06 20:25:29 瀏覽:751
專家系統原理與編程 發布:2025-03-06 20:21:05 瀏覽:641
腳本召喚暴龍 發布:2025-03-06 20:19:29 瀏覽:81