I have a loop that iterates over a series of text files (all are in the form name.txt):
for txt in *txt; do
    sed -i '$ d' $txt 
done
But whenever there is no .txt file in the directory, I get the following error message:
sed: can't read ‘*txt’: No such file or directory
 
     
     
    