• Mike Hibler's avatar
    The Joy of Sed. · a861dd6c
    Mike Hibler authored
    We were parsing the disk number out with:
    
      dunit=`echo $disk | sed -e 's/..\([0-7]\)/\1/'`
    
    which works fine with "ad0", giving a dunit of "0"
    but with "ada0" you get a dunit of "a0"
    
    And, after misinterpreting through another sed command:
    
    dunit=`echo $dunit | sed -e 'y/01234567/abcdefgh/'`
    
    we get "aa" instead of "a". Append that to "sd" and your disk
    becomes "sdaa" instead of "sda". Next thing you know I'm blaming
    Emacs for inserting an extra character in /etc/fstab!
    a861dd6c
slicefix 31.8 KB