|
|
10.5: Mount a partition or volume on demand
So this is what i got:
It does the trick nicely for me. I just added a word boundary around the partition name e.g. \y...\y I don't have any partition with spaces but it might work as well.
10.5: Mount a partition or volume on demand
The && echo... is of course not necessary... I was just using for tests purposes.
The bash script would look like this:
10.5: Mount a partition or volume on demand
So this is what i got: dev_id=`diskutil list | awk '/\yPARTION_NAME\y/{ match( $0, /disk[0-9]+(s[0-9]+)?/ ); print substr( $0, RSTART, RLENGTH); }'` && echo $dev_id It does the trick nicely for me. I just added a word boundary around the partition name e.g. y...y I don't have any partition with spaces but it might work as well.I puddled with it a bit and decided to drop awk altogether - ended up with this:
the first grep returns a line where the partition name is in the name column and has at least two spaces following; the second grep digs out the actual device name from that line. not very elegant, though...
is there a way to tell awk to use fixed width fields rather than delimiters? apparently there is supposed to be a FIELDWIDTHS variable that can be set, but I can't seem to get it to work in Darwin. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|