如何在bash中的if语句中检查函数是否返回true?

时间:2015-11-20 14:55:40

标签: bash function if-statement

我想检查函数mdfind是否返回true,并且我的意思是它是否找到用户在读取调用中的变量中指定的内容。

这就是我所得到的,但它不起作用:

#!/bin/bash
clear
echo "Loading..."
sleep 2
clear
echo "Grand Theft Auto Launcher | v1.0"
echo -n "Grand Theft Auto Game Name: "
read game

if [ mdfind $game ]
then
clear
echo "$game found."
echo "Launching..."
fi

0 个答案:

没有答案
相关问题