Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 31st, 2008, 12:52 AM   #1
sons_of_bitch
Newbie
 
Join Date: Jan 2008
Posts: 2
Rep Power: 0 sons_of_bitch is on a distinguished road
scripting question

hi all,

i'm new here, i would like to add on the print command to prompt user to enter a value and store inside the variable name as $inName like
print "what is your directory : ";
then the answer is storing to &inName

after that the value will replace the existing line for ${METRICA_DIR}/TechnologyPacks/Spool/2030324032
i'm new in scripting, could anyone give me some hint for sripting?

tmpfile=/tmp/tmpfile.$$

for file in loaderconfiguration*.xml
do
sed "s|${METRICA_DIR}/TechnologyPacks/Spool/2030324032|$inName|g" $file > $tmpfile
mv $tmpfile $file
done

thanks
sons_of_bitch is offline   Reply With Quote
Old Feb 11th, 2008, 2:24 PM   #2
jim mcnamara
Hobbyist Programmer
 
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4 jim mcnamara is on a distinguished road
Re: scripting question

echo "Which directory \c"
read directory
tmpfile=/tmp/tmpfile.$$

for file in loaderconfiguration*.xml
do
  sed "s|${directory}|$inName|g" $file > $tmpfile
  mv $tmpfile $file
done

BEFORE you run this - where is the variable inName defined in your code? As is, it is null.
It needs to be set to something, somewhere, before the for loop.
jim mcnamara is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic 2005 Question ReubenK Visual Basic .NET 3 Apr 5th, 2006 3:23 PM
Do you use perl over bash scripting? linuxpimp20 Perl 3 Sep 12th, 2005 2:29 PM
How to post a question nnxion C++ 10 Jun 3rd, 2005 11:53 AM
How to post a question nnxion C++ 0 Jun 3rd, 2005 8:55 AM
How to post a question nnxion C 0 Jun 3rd, 2005 8:55 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:49 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC