checker.sh (236B)
1#!/bin/bash 2 3read -p "Input a file path: " filepath 4file $filepath 2>/dev/null | grep -q "ASCII text" 2>/dev/null 5 6# TODO: print the result the above command. 7# $? == 0 -> It's a text file. 8# $? != 0 -> It's not a text file. 9exit 0