这段代码有什么问题?
#!/bin/bash
ARCH=$(uname -m)
if ["$ARCH" = "i686"]; then
zenity --info --title="Architechture Checker" --text="Your Architechture is 32-Bit"
if ["$ARCH" = "x86_64"];then
zenity --info --title="Architechture Checker" --text= "Your Architechture is 64-Bit"
Run Code Online (Sandbox Code Playgroud)
“if”没有匹配的“fi”
您需要在“[”和“]”周围放置空格
"--text=" 后的空格会使参数丢失。
工作版本:
#!/bin/bash
ARCH=$(uname -m)
if [ "$ARCH" = "i686" ]; then
zenity --info --title="Architechture Checker" --text="Your Architechture is 32-Bit"
fi
if [ "$ARCH" = "x86_64" ]; then
zenity --info --title="Architechture Checker" --text="Your Architechture is 64-Bit"
fi
Run Code Online (Sandbox Code Playgroud)