小编Eth*_*han的帖子

Bash 脚本因“条件表达式中的语法错误”而失败

我是 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)

所以我的手被扔在了这里……怎么了?

linux script bash

1
推荐指数
2
解决办法
3461
查看次数

标签 统计

bash ×1

linux ×1

script ×1