|
|
This script is flawed!
The only way that I could replicate your results, I guess, would be to try to create mountable volumes with all those disk names. But I did considerable testing on the script I submitted with quite a few different volumes mounted. The list you include first (yours is generated by "df -k") when generated by my script does not include all the volumes that yours includes because it isn't "df -k", it's "df -k | awk -F/ '/disk*/ {print $3}'", and it returns a listing for only the items appearing in your second list. My observation is that because the order of the listed items doesn't change between the filtering of the constructs based on "df -k" and "df -hlg", the script that filters out ineligible members still draws the correct association of items in the two lists. Can you store the output of the two initial commands from my script ("df -k | awk -F/ '/disk*/ {print $3}'", and "df -hlg | awk -F/ '/disk*/ {print $5}'") on your system so they can be compared line for line with the output you already included for "df -hlg"? Edited on May 09, '12 01:30:41PM by llee
This script is flawed!
Hmm, well, could it be as short and sweet as this? Edited on May 09, '12 08:55:12PM by llee
I like it (shorter and simpler)
I tried your shorter version and indeed it works here too. I think the key to this story was to have just one list, the one generated by 'df -l'. Since you asked me (and I know that doesn't really matter anymore),
% df -hlg | awk -F/ '/disk*/ {print $5}'
LionHD
Spare
MacExt
SmallSave
and 'df -k | awk -F/ '/disk*/ {print $3}':
df -k | awk -F/ '/disk*/ {print $3}'
disk0s2 79203656 51490116 27457540 66%
disk2s2 365784156 332114676 33669480 91%
disk1s1 66559996 65618364 941632 99%
disk1s2 36141052 35825216 315836 100%
disk1s3 53588152 48312940 5275212 91%
disk3s1 256702603 251655316 5047286 99%
disk3s2 306239060 303196908 3042152 100%
disk3s3 35929372 34222232 1707140 96%
That's why it didn't work here. As a side note, there's a slight typo in the awk script regex, which should be /disk.*/ and not /disk*/ (luckily it doesn't change anything for the intended purpose). I'm glad you didn't take it the wrong way and that you came up with a really short solution, and I hope I didn't came off as being too pedantic. ;-) |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks 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.27 seconds |
|