vendredi 20 novembre 2015

How to check if a function returns true inside an if statement in bash? [duplicate]

This question already has an answer here:

I want to check if the function mdfind returns true, and by that I mean if it finds what the user specified in a variable from a read call.

This is what I've got but it isn't working:

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

Aucun commentaire:

Enregistrer un commentaire