in reply to Re^2: Differentiating STDIN from arguments when using -n ?
in thread Differentiating STDIN from arguments when using -n ?

You don't really need a loop for that, you could do it like this:

mounted_disks=$(mount | perl -le'$d = shift; print join " ", sort { le +ngth( $b ) <=> length( $a ) } map m{/dev/$d} ? (split)[2] : (), <>' $ +dest)

Or even move the mount command into the perl code:

mounted_disks=$(perl -le'$d = shift; print join " ", sort { length( $b + ) <=> length( $a ) } map m{/dev/$d} ? (split)[2] : (), qx(mount)' $d +est)

Replies are listed 'Best First'.
Re^4: Differentiating STDIN from arguments when using -n ?
by rduke15 (Beadle) on Sep 16, 2007 at 07:57 UTC
    Cool alternative, even if it took me a moment to understand... Thanks.