Programatically Re-start USB Bluetooth Adapter

Folks I have a usb bluetooth dongle which only works after I remove and re-attach it, can I mount un-mount it from command line to have it to be programmatically re-attached?


#Restart all USB devices
set -euo pipefail


for DIR in $(find /sys/bus/usb/devices/ -maxdepth 1 -type l); do
  if [[ -f $DIR/idVendor && -f $DIR/idProduct &&
        $(cat $DIR/idVendor) == $VENDOR && $(cat $DIR/idProduct) == $PRODUCT ]]; then
    echo 0 > $DIR/authorized
    sleep 2 
    echo 1 > $DIR/authorized

There’s also a bluetooth restart service in the archive

Yeah I had seen those links, specially the stack exchange one. Still there is a small detail i’ve omitted by mistake its a Bluetooth dongle. Echoing as suggested:
sh -c "echo > 0 /sys/bus/usb/devices/1-13/authorized"

Did not work. Just found a better discussion in ask ubuntu:

Gonna try it tommorow

Guys I did not manage to make it work I sitll need to unplug and replug it. Can you give me some help?