if you are at current/working directory, why need to change to?
try pwd -P for absolute path
Good luck
jim lawrence wrote:
I'm trying to get this script to function correctly it uses imagemagick in it.
here is the script it will do what i want it to but it wont change to
the folder specified
##########################################################################
#!/bin/bash
# Convert jpeg images to jpeg but smaller
############
# Varibles #
############
images=`pwd`
#############
# Functions #
#############
# Now ask the user where images are
function LOCATION
{
# get the location
read -p "Enter the location of the images [$images]: "
# How can I store what is read in into a varible?
if [ -z "$images" ]; then
$images = "$images"
#change to the location of the images
cd $images <--- I think it isn't changing to the correct directory
##############################################################
# lets create some thumbnails <--- this section by its self in a
folder with images will work.
for img in `ls *.jpg`
do
convert -sample 25%x25% $img thumb-$img
done
#############################################################
# wish i could put something out saying " Were Done"
fi
}
#############
# a little interface #
#############
selection=
until [ "$selection" = "0" ]; do
echo ""
echo "Options..."
echo " 1 - Seek n Convert"
echo " 2 - Not used Yet"
echo " 3 - Location"
echo " 0 - Close"
echo ""
echo -n "Enter a Number: "
read selection
###################
# Cases selection #
###################
case $selection in
1 ) $(LOCATION) ;;
2 ) $(Not Used yet) ;;
3 ) pwd ;;
0 ) exit ;;
* ) echo "Please enter 1, 2, 3 or 0"
esac
done
#########################################################################
Any help would be great.
Thanks jim