I would like to echo something from an output of a command that returns nothing.
This is the content of fnames.txt
company_TOYOTA_666_696969696*
company_FORD_123_435345666*
company_MAZDA_333_333333333*
company_HONDA_777_777777777*
company_FERARI_999_999999999*
This is my script to find each files in a line from fnames.txt:
#!/bin/sh
while read -r LINE
do
output=$(find . -name "$LINE")
if [[ $output ]];
then
printf "$output\n"
elif [[ $output -eq 0 ]];
then
echo "$LINE Not Found"
fi
done < /path/to/fnames.txt
But when I try to execute it, it only outputs the files it found not the elif statement that echo's the filename it didn't find:
./company_TOYOTA_666_696969696_11_22_33_4542352345.dat
./company_FORD_123_435345666_11_22_33_4542352345.dat
./company_MAZDA_333_333333333_11_22_33_4542352345.dat
./company_HONDA_777_777777777_11_22_33_4542352345.dat
I would like it to output this:
./company_TOYOTA_666_696969696_11_22_33_4542352345.dat
./company_FORD_123_435345666_11_22_33_4542352345.dat
./company_MAZDA_333_333333333_11_22_33_4542352345.dat
./company_HONDA_777_777777777_11_22_33_4542352345.dat
company_FERARI_999_999999999* Not Found
"$output"instead of plain$output.