Bash ã«ããã¦ãå¤æ°ãç¹å®ã®æååã§çµãããã確èªãããã±ã¼ã¹ãããã¾ãã ãã Bash ã®ã¿ã§å®ç¾ãå¯è½ã§ãã
[[ ${user_arn} == *Terraformer ]]
Bash ã«ããã [
㨠[[
ã·ã§ã«ã¹ã¯ãªããã§ä½¿ç¨ããã [
ãã³ãã³ãã§ããäºå®ã¯ããç¥ããã¦ãã¾ããã[[
㯠bash çã®ã·ã§ã«ã§ç¬èªã«å®è£
ããã¦ãã¾ãã
$ type '[' [ is a shell builtin $ type '[[' [[ is a reserved word
Bash ã§ã¯ [[
㨠]]
ã«å¯¾ãã¦ããªãæ¡å¼µããå®è£
ããã¦ãã¾ãããããæ¡ä»¶åå²æã«ä½¿ç¨ããã¨ãæ£è¦è¡¨ç¾ãããã®å©ç¨ãã§ãããã[
ã§ã®ãããã©ãã (æååæ¯è¼ã§ >
ãã¨ã¹ã±ã¼ãããå¿
è¦ãããç) ãåé¿ã§ããããã¾ãã
ããã¦ãBash ã«ããã¦ã¯ [[
㨠]]
ã®ä¸ã«ããã¦ã glob pattern ãå©ç¨ã§ãã¾ãããããå©ç¨ããã°ãæååæ«å°¾ã®ä¸è´ç¢ºèªçãå®ç¾ã§ãã¾ãã
$ [[ hogehoge = hoge* ]] && echo "match" match $ [[ fugahoge = hoge* ]] && echo "match" $ [[ hogehoge = *hoge ]] && echo "match" match $ [[ hogehogefuga = *hoge ]] && echo "match"
Bash ã«ããã Glob ã«ã¤ãã¦ã¯ãã¡ãããåç §ãã ããã