The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-21-2009
trey85stang trey85stang is offline
Registered User
  
 

Join Date: May 2008
Posts: 70
/bin/bash - variable substitution.

Is it possible with a bash variable to perform multiple substitution strings to one variable?

I have this variable:
echo $clock
TIMEZONE="US/Central"

What I would like to do with bash only it pull out just the "US" part of the variable.. which could be any number of countries.

this is where I am at:

echo ${clock:10}
US/Central"

echo ${clock:10#*/}
bash: testing: 10#*/: syntax error: operand expected (error token is "/")

echo ${clock#*/}
Central"


So, am I just missing something.. or can I only do one type of substition with a bash variable?

thanks,
Trey