Skip to content

Instantly share code, notes, and snippets.

@somian
Created September 2, 2013 11:26
Show Gist options
  • Save somian/6411884 to your computer and use it in GitHub Desktop.
Save somian/6411884 to your computer and use it in GitHub Desktop.
A slightly more useful stab at the previous gist.
blkid -s TYPE|egrep vfat | cut -d \: -f 1| xargs /sbin/blkid -c value|
xargs perl -MCarp -MFile::Util="" -e '$it=File::Util->new();' \
-e 'my($lab)= grep{$_} map{/LABEL=([^=]+)(?=[[:space:]][[:upper:]]+[=])*/;' \
-e '($1 ? do{($_=$it->escape_filename($1))=~s{[[:space:]]}{_}g and qq[/media/byLABELISH/$_]}' \
-e ': q[])} grep {LABEL} @ARGV; print qq[We shall try to make $lab if it does not exist.\n];' \
-e 'unless (-d $it){$it->make_dir($lab) || croak qq[Well, that failed somehow.\n]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment