file validation in linux scripting

If you want to do it in pure bash, use the following script: #!/bin/bash while read line; do line=( ${line//[:]/ } ) for i in “${!line[@]}”; do [ ! -z “${line[$i]##*[!0-9]*}” ] && printf “integer” || printf “string” [ “$i” -ne $(( ${#line[@]} – 1)) ] && printf “:” || echo done done < $1 … Read more