Created
April 24, 2019 15:47
-
-
Save acobaugh/88d0f2d26cb2b1e3aeef291828c72ff4 to your computer and use it in GitHub Desktop.
A silly little script to potentially rebuild an fstab file based on the contents of mtab.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
while read line ; do | |
if [ "$(echo $line | egrep '^\/dev\/sd')" != "" ] ; then | |
dev="$(echo $line | awk '{ print $1 }')" | |
id="$(blkid $dev | awk '{ print $2 }')" | |
echo $line | sed -e "s|$dev|$id|" | |
else | |
echo $line | |
fi | |
done < /etc/mtab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment