I know this has to be such a simple solution, but I can not figure it out...
I have a string
Code:
GALNAME="Our Family Photos"
I want to create a new string with teh same name except replacing spaces with underscores. I do that with
Code:
GALNAME_NO_SP=`echo "$GALNAME" | tr " " "_"`
That wroks fine. Here's where I'm stuck. I want to create a third string That concatenates the new string with some other info and strings.
Code:
PAGENUMER=1
echo "$GALNAME_NO_SP_page$PAGENUMBER"
I want the to echo "Our_Family_Photos_page1". All it echos is "1". The shell is interpreting "$GALNAME_NO_SP_page" as a variable.
How can I get the shell to interpret $GALNAME_NO_SP as the variable and cat "_page" at the end? If I do
Code:
echo "$GALNAME_NO_SP _page$PAGENUMBER"
then I get "Our_Family_Photos _page1" with a space
Any thoughts?