我有一个小 bash 脚本,我想在其中获取文件的格式。
FILENAME=$1
GET_FILE_FORMAT=`file $FILENAME | grep -i data`
if[[ "$GET_FILE_FORMAT" = *data* ]]
echo "Format Data";
fi
但是我得到的输出如下
./try.bash test.data
./try.bash: line 4: if[[ test.data : data = *data* ]]: No such file or directory
Format Data
./try.bash: line 6: syntax error near unexpected token `fi'
./try.bash: line 6: `fi'