Writing a bash script to turn on and off the USB ports on a raspberry pi 4. Using uhubctl.
#!/bin/bash # Script to turn on and off power to usb port # Uses uhubctl # time_w=5 #cd uhubctl uhubctl -a off -l 1-1 # sleep "$time_w" # uhubctl -a on -l 1-1 # echo "All done"
I can run this
sudo uhubctl -a off -l 1-1 from the command line without issue.
But if I run the script with
sudo bash USB_Power.sh I get the following error.
!o compatible smart hubs detected at location 1-1 Run with -h to get usage info. All done