I need to copy a file from a flash disk connected to my Raspberry Pi when it boots and then execute the copied file. The reason for this is because it seems that I cannot execute the file from my USB drive.
What I did was:
sudo nano /etc/rc.local
and added the following (in order to copy the file from the USB drive to the Pi folder - drive is the USB drive name - and then run the file):
cp /media/pi/drive/file /home/pi sudo ./home/pi/file &
Both commands work when I enter it into terminal but this doesn't execute on startup.
Reason is that should I wish to change the program I can do so on another Pi, copy it onto the USB and restart the Pi to copy/replace the existing file and execute.