Hi all,
I am trying to do a simple thing in my mind. However I am fairly new to bash. What I need to do is create a folder for each partition on each CD, and each partition has a unique name (with spaces in it, do not ask why, it is already done
) . All CD's will show up under disk1s. So what I have done is create a script that will grab the name, assuming that there is only 1 partition (which I never knew anyone would create partitions on a CD).
So my script write now is
if [-z `diskutil list | grep disk1s0 | awk '{print$3}' ] ; then
Name = `diskutil list | grep disk1s1s2 | awk '{print$3}'
T1 = "Mass"
if[$T1 = $Name]; then
echo `diskutil list | grep disk1s1s2 | awk '{print$3 " " $4}'
else
echo `diskutil list | grep disk1s1s2 | awk '{print$3}'
fi
else
echo `diskutil list | grep disk1s0 | awk '{print$3}'
fi
what I need to add is if the disk1s1s2 name starts with Mass is I need it to look at the name of possibily multiple partitions
echo `diskutil list | grep disk1s1s2 | awk '{print$3 " " $4}'
echo `diskutil list | grep disk1s2s2 | awk '{print$3 " " $4}'
echo `diskutil list | grep disk1s3s2 | awk '{print$3 " " $4}'
echo `diskutil list | grep disk1s4s2 | awk '{print$3 " " $4}'
echo `diskutil list | grep disk1s5s2 | awk '{print$3 " " $4}'
and so on, I have seen at least 10, but there could be more, and could be less.
How would I script for this? Any help would be great.
Thanks,
Steven Stuart