mardi 15 août 2017

Writing case statements in a bash script

#!/bin/bash
until [read command -eq "end"]
do
echo What command would like to run?
read command
if [$command -eq "my-tweets"]; then
node liri.js $command
fi
if [$command -eq "do-what-it-says"];then
node liri.js $command
fi
if [$command -eq "spotify-this-song"]; then
echo What item would like to query?
read item
node liri.js $command $item
fi
if [$command -eq "movie-this"]; then
echo What item would like to query?
read item
node liri.js $command $item
fi
done

I am trying to create a case/if statement to check the value of a variable before running the next part of the code. I want to check the value of $command to create this case/if statement according to the value of the user input. I keep getting the command not found error.

Aucun commentaire:

Enregistrer un commentaire