I use the following shell syntax (from my previos questione, answered by - phemient) in order to verify if file is ASCII (text) or other
if LC_ALL=C grep -q '[^[:print:][:space:]]' file; then echo "file contains non-ascii characters" else echo "file contains ascii characters only" fi
the problem is that I get "file contains non-ascii characters" (from the shell script syntax) even if the test_file is ASCII file why?
I also test the file with file command and this is what I get
file test_file Non-ISO extended-ASCII English text" its also ASCII file
my question: how to change the shell syntax in order to support also "Non-ISO extended-ASCII English text" ?
so I will get the print "file contains ascii characters only" from the shell script
remark the solution must be for Linux and solaris