Is there a way I could autodetect a drive identifier? For example, below I would like to be able to put "disk1s1" into a variable (meaning that every time that the script I am writing runs I would like to be able to figure out the disk number for my BACKUP 1 Partition). I am not an expert, sorry if this is a stupid question, any help appreciated because I am interested in getting better at this.
Michael-Fredericks-Mac-Pro:~ Mike$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *1.0 TB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS Macintosh HD 700.1 GB disk0s2
3: Microsoft Basic Data 299.7 GB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *1.5 TB disk1
1: Apple_HFS Backup 1 998.6 GB disk1s1
2: Apple_HFS Backup 2 501.7 GB disk1s2
---------- Post updated at 08:50 AM ---------- Previous update was at 08:27 AM ----------
I used the following code to get the info I want, now I need to store that in a variable. Again, clearly I am not familiar with the convention that should be used.
diskutil list | grep Backup\ 1 | awk '{print $7}'
---------- Post updated at 08:53 AM ---------- Previous update was at 08:50 AM ----------
nvm, got it, really easy