Skip to content

Instantly share code, notes, and snippets.

@KyWa
Created November 10, 2021 03:25
Show Gist options
  • Save KyWa/42308a384418b99816624b6423028deb to your computer and use it in GitHub Desktop.
Save KyWa/42308a384418b99816624b6423028deb to your computer and use it in GitHub Desktop.
Bash Check Filesystem Type
#!/bin/bash
if [ -z "$1" ];then
echo "0 Arguments given. Please pass in a disk path"
echo ""
fi
fstype=`df -T | grep $1 | awk '{print $2}'`
if [[ $fstype == "ext4" ]];then
echo "do the thing"
else
echo "don't do the thing"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment