Bash file names with spaces
I have a laptop that I am in through SSH. The laptop does not have an Xwindow system so I am using the program fbi to open an image on my laptop screen from my SSH connection:
fbi -T 8 picture.jpg #this opens the image on the laptops tty8 terminal
I've found that making a for loop does not work with files that contain a space in the name. Something to due with a bug that they call a "feature" that stops the first variable at the first whitespace.
Using a "while" loop is not exactly what i require either seeing as I want to be able to view each image in the directory on screen and tag it accordingly, before it jumps off to the next image, and I'm not sure how to add a pause to a while loop.
How do I make a Bash script and loop Variables handle files like "files that contain spaces.jpg"
By terminating with a null char as in 'find /path/to/pictures -type f -iname \*.jpg -print0 | xargs -iX -0 fbi -T 8 'X';' or proper use of quoting?
When I find filenames with spaces I use the IFS="
" environment variable to get around this. For example:
edit: trying what tony wrote
echo "this post" > /dev/null
Found what I was looking for:
this is a cut out of what I did to solve it:
read -p "press enter to continue"
for FILE in *.jpg; do
echo "open $FILE"
fbi -T 8 "$FILE"
echo "send switch signal and enter tagging code here"
echo game over
earlier I was trying to do some sort of ALL=`ls -1 *.jpg and trying to get the for loop to read the $ALL variable 1 line at a time. DO NOT DO THAT IN THIS CASE.
|All times are GMT -5. The time now is 07:56 PM.|