#!/bin/ksh while read -r file do if [ -e "$file" ] then printf 'file "%s" exists.\n' "$file" ls -lrt "$file" else printf 'file "%s" does not exist.\n" "$file" fi done < files.txt