I want to read the full file name, but it always auto separator by space
#!/bin/dash
for file in `ls | grep -E '(jpg)$' | sed 's/\.jpg//g'`
do
echo ${file}
done
This will work when the file name do not contain space or other symbol. But it do not work when the file name like : A B C.jpg This will print
A
B
C
It sepator the file name by space, how can i avoid this situation