Script for rescanning new hdd disks


#1

Hello everyone, I have Fedora 29 OS on my desktop and I’d like to add my hdd disks in the internal enclosure - mobile racks.
But unfortunately, my PC doesn’t find new disks.
In this case, I use this command to rescan them:
echo “- - -” >/sys/class/scsi_host/hostX/scan, where X are numbers of the SATA ports, for instance (from 0 to 4)
I’d like to have a script for rescan all ports, but I can’t write the script, because I don’t know how should I write it for all ports instead X.
Should I use four command like them:
echo “- - -” >/sys/class/scsi_host/host0/scan
echo “- - -” >/sys/class/scsi_host/host1/scan
echo “- - -” >/sys/class/scsi_host/host2/scan
echo “- - -” >/sys/class/scsi_host/host3/scan

or maybe there is another way to compose the command.