samedi 20 décembre 2014

Execute a script when a user enters a correct code from a list of codes

how to create a list of 4 codes where when a user inputs one of these codes, the script will excute another script


here is what i have (concept)



#!/bin/bash
user_code = ("123", "456", "789", "011")
echo -n "Enter Code Number > "
read code
echo "You entered : $text"
if [ "$code" = user_code ]
then
echo "Code Correct"
cd /home/pi/Desktop/led/
python run_washer.py
else
echo "Wrong Code, Try again"
fi

Aucun commentaire:

Enregistrer un commentaire