Search code examples
linuxbashshellraspbian

bash command 'echo -n -e "\x87" > /dev/ttyAMA0' not working from shell script


I'm trying to controll my Roomba vacuum cleaner by a RaspberryPi. But still having some problems.

I need to send a special command to the serial interface to start the vacuum cleaner. If I do this in the Bash it works fine:

echo -n -e "\x87" > /dev/ttyAMA0

If I put this in my shell script it does not work any more:

#! /bin/bash
echo -n -e "\x87" > /dev/ttyAMA0

Any idea?


Solution

  • Have you made the script runnable? I.E. chmod +x script.sh. Also make sure you are running the script correctly ./script.sh. For more help see this website.