Syntax error: word unexpected (expecting ")")

该问题在不同操作系统表现不同,可能在 centos 系统可以正常运行,但是在 ubuntu 不行

原因在于
如果以 sh 启动,这个不是标准的 posix shell 脚本
但是以 bash 启动,是标准的 posix shell 脚本


The construct (( $? )) 不是有效的 POSIX sh, nor is ($ans != "yes") when $ans is empty. They are hardly valid in bash either (TBH, this is the first time in 20yrs I see the idiom (( $? ))) but apparently bash lets it pass.

  
    展开阅读全文