Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
->[[ "abc~" == *~ ]]; echo $?; [[ *~ == "abc~" ]]; echo $? 0 1
在上面的片段中,为什么比较顺序似乎会影响真值?
模式匹配仅在==. 第二个示例按*~字面意思计算字符串。
==
*~
这就是为什么在双括号中的表达式的右侧需要引用,而左侧不需要引用的原因。
[[ $a == "$b" ]] # Right [[ "$a" == $b ]] # Wrong
我认为我已经习惯了关于项目中 PHP 声明的相当自由的政策 - 我一直只是使用:
<? // here is my php code ?>
我只是在 FastCGI 下使用 PHP-FPM 设置了一个 nginx 服务器,现在它需要我明确声明:
<?php // here is my php code ?&