#!/bin/bash VERBOSE=0; if [[ $1 =-v ]] then VERBOSE=1; shift; fi
当我运行这个(bash 4.0.33)时,我得到以下语法错误:
./test.sh: line 4: conditional binary operator expected ./test.sh: line 4: syntax error near `=-v' ./test.sh: line 4: `if [[ $1 =-v ]]'
Bash使用空格来标记脚本。线路:
if [[ $1 =-v ]]
if [[ $1 = -v ]]