0

I bought an RFID USB kit and haven't been able to read the RFID IDs with the following Bash script.

#!/bin/bash

while [ read -r rfid ] ; do

#URL=http://www.mainpage.us/rfid/status.php?number=$rfid

#curl --request POST $URL

echo $rfid
sleep 1

done < /dev/cu.usbserial-A600JNHR

The RFID should work fine as per the terminal. What am I doing wrong?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
DasBoot
  • 707
  • 3
  • 15
  • 37
  • 1
    Looks like you should be making a serial connection to the device. See minicom, cutecom, putty, or GNU screen. Also, the [] is not needed in your loop condition. – jordanm Jun 29 '12 at 21:42
  • Jordanm may be onto something, have you tried not using the `[]`? It shouldn't work with them. – Kevin Jun 30 '12 at 02:06
  • minicom worked, it did give me an output on putty but the code above was not doing it for me. – DasBoot Jul 02 '12 at 20:13

1 Answers1

1

[ is a command. Since you want to use read, you should not try to use [.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358