我是 bash 脚本的新手,我只想做一个简单的小事,但是我在网上阅读的所有内容似乎都不适合我!
所以我在这里有这个脚本:
#!/bin/bash
if [[ $1 = "32"]]
then
mv config.h config64.h
mv config32.h config.h
mv Makefile Makefile64
mv Makefile32 Makefile
echo "READY FOR 32 BITS!"
elif [[ $2 = "64" ]]
then
mv config.h config32.h
mv config64.h config.h
mv Makefile Makefile32
mv Makefile64 Makefile
echo "READY FOR 64 BITS!"
fi
Run Code Online (Sandbox Code Playgroud)
我得到错误:
./switch-bits.sh: line 3: syntax error in conditional expression
./switch-bits.sh: line 4: syntax error near `then'
./switch-bits.sh: line 4: `then'
Run Code Online (Sandbox Code Playgroud)
所以我的手被扔在了这里……怎么了?