这个 Zenity 代码有什么问题?

Lin*_*ity 0 bash zenity

这段代码有什么问题?

#!/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)

Ali*_*ton 9

  1. “if”没有匹配的“fi”

  2. 您需要在“[”和“]”周围放置空格

  3. "--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)