0

I am writing a Cash-System for a small Cafe, using a Raspberry 2 (Raspbian OS), a Touchscreen and an RFID Reader.

I want to get completely rid of a keyboard and mouse. So all user interactions have to happen with touchscreen or RFID. Every employee has its own RFID chip and should be able to start the Cashsystem from console (without having to type "sh start_cash.sh" oslt.

The Raspberry starts directly to a bash without password oslt. The cashsystem is written in JavaFX (so no X Server is permitted). When I place the RFID over the reader, the tagnumber+enter is written onto the console, which seems pretty handy here. But I cannot manage to write a shellscript with the name of the rfid number, which then starts, without typing a "sh" before the rfid number (which is not possible without a keyboard).

So lets assume: I have two different rfid tags (1 and 2) and two different shellscripts (A and B). What do I need to do, that rfid 1 starts script A and rfid 2 starts script B?

Sauer
  • 1,429
  • 4
  • 17
  • 32
  • I think my last paragraph is narrow enough. And the answer given below does work indeed! Thanks for that one! But I found another way I'd like to share with you. So please reopen this issue again! – Sauer Sep 03 '15 at 14:33

1 Answers1

2

case statement

case $rfidID in
     RFIDTAG1) 
        ./employeeA.sh
        ;;
     RFIDTAG2)
        ./employeeB.sh
        ;;
      *)
        echo "Employee ID not found"
        ;;
esac

but if you have a lot of employees maybe this will be more efficient?

#!/bin/sh

echo "Please sign in with Employee ID"
read rfidemployee

./Employee$rfidemployee.sh

so essentially you will make a shell script with Employee (or whatever you want to use) and follow it will be there ID number. For example. Employee1234.sh

then when the employee signs out they re execute script for a employee to log in.

andyADD
  • 610
  • 1
  • 6
  • 20
  • Thanks andyAdd! This works well, but I solved it differently: I created aliasses like this: alias 111111="sh shellscriptA.sh" and alias 222222="sh shellscriptB.sh". this is withoug writing a new script. But thanks anyway! – Sauer Sep 03 '15 at 14:33
  • Could you happen to share the source code? I am curious. – andyADD Sep 03 '15 at 14:36
  • alias 00012345="sh myscript.sh" - Thats all. When the employee then scans the rfid, the number 00012345 is interpreted as a "executable" and the real shellscript "myscripts.sh" is being started. There is no other source code... – Sauer Sep 03 '15 at 14:39