The problem arises because you are using an undefined subshell and the flag -F
for ls displays special shell characters added to the file names.
-F, --classify
add an indicator (one of * / => @ |) to the entry
Executable files are added using *.
At startup
echo $(ls -1 -tF | head -n 1)
then
$(ls -1 -tF | head -n 1)
will return the file name, and if it is an executable file, and there will also be a prefix for another file, it will return both.
,
test.sh
test.sh.backup
test.sh*
-
test.sh test.sh.backup
echo "$(ls -1 -tF | head -n 1)"
test.sh*