Что случилось с этим кодом?
#!/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"
Никакое соответствие "fi" для, "если" s
Необходимо поместить пробел вокруг" [" и"]"
Пространство после "-текст =" заставляет параметр потеряться.
Рабочая версия:
#!/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
Или, с помощью случая вместо этого (и также функция для сокращения его немного).
#!/bin/bash
zinfo() { zenity --info --title="Architecture Checker" --text="$1"; }
case $(uname -m) in
i686) zinfo "Your architecture is 32-bit" ;;
x86_64) zinfo "Your architecture is 64-bit" ;;
*) zinfo "Your architecture is unknown to me" ;;
esac