I would like to strip the extension from the end of the image name for use elsewhere in an html file. There a very large number of pictures and I want to use this in a scrip that will also write the HTML code.
This code snippet dose not perform as I understand the example on Stack Overflow.
Code:
http://stackoverflow.com/questions/125281/how-do-i-remove-the-file-suffix-and-path-portion-from-a-path-string-in-bash
Two days I've read the internet and tried differenet things, nothing has worked. Can someone help?
Thanks
Dave
Code Snippet:
Code:
#! /bin/bash
for image_name in *.jpeg *.jpg *.JPG *.gif *.GIF *.png *.PNG;
do
echo "$image_name"; ##trouble shoot
image_type=${image_name%.}
echo "$image_type"; ##trouble shoot
done;
This is the screen output I get:
Quote:
dave@dave-EL1600:~/projects/web-gallery$ ./looptest.sh
*.jpeg
*.jpeg
View From Above.jpg
View From Above.jpg
Virgil1.jpg
Virgil1.jpg
wading.jpg
wading.jpg
WaterColor.jpg
WaterColor.jpg
WCR_9871.jpg
WCR_9871.jpg
WCR_9878.jpg
WCR_9878.jpg
*.JPG
*.JPG
*.gif
*.gif
*.GIF
*.GIF
*.png
*.png
*.PNG
*.PNG
dave@dave-EL1600:~/projects/web-gallery$
|