Register
It is currently Fri Oct 31, 2014 7:35 am

set variable value within string


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Tue Mar 23, 2010 8:15 am   

Joined: Tue Mar 23, 2010 7:39 am
Posts: 2
Hi,
I would like to set a value to a variable which is within a string.
example will give you better understanding

one file contains a string lets call him 'stringFile'
${install_path}/some/path/file.txt

now a bash script is reading this file and contains a variable install_path like this
#!/bin/bash

install_path="/usr/local"
while read line
do
echo "$line"
done < stringFile

Output of this script is: ${install_path}/some/path/file.txt
but i would like that the outpus is: /usr/local/some/path/file.txt

how to achieve this?
Thank you.


Top
 Profile  
 PostPosted: Tue Mar 23, 2010 8:23 am   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 551
Hi, registerska,

take a look at:
Code:
help eval


Top
 Profile  
 PostPosted: Tue Mar 23, 2010 9:34 am   

Joined: Tue Mar 23, 2010 7:39 am
Posts: 2
Thank you Watael.
problem solved


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP