view bin/linux-drive-number-mapping @ 632:c950f0ef2268

Apparently better use githubusercontent? Also sort.
author nanaya <me@nanaya.pro>
date Fri, 18 Oct 2019 15:49:35 +0900
parents f579b5310a1b
children
line wrap: on
line source

#!/bin/sh

# Stolen from http://superuser.com/questions/617192

[ "$(uname)" = "Linux" ] || exit 1

ata=$1
ls -l /sys/block/sd* | grep $(grep $ata /sys/class/scsi_host/host*/unique_id | awk -F'/' '{print $5}')