Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > Your Distro > Redhat / Fedora Linux Help > Bash scripting

Forgot Password?
 Redhat / Fedora Linux Help   Help and discussion related to Redhat and Fedora Linux.

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 06-29-2006   #1 (permalink)
Just Joined!
 
Join Date: Jan 2006
Posts: 13
Bash scripting

Hi

I am tryinf to something relatively simple but seem unable to get this script working. I simply want to replace the number associated with a certain work. I am using sed. However when I incorporate the working sed command into my script it does not work any longer.

#!/bin/sh
for i in `seq 0 9`
do
x=24
y=1000
Result=`expr $i + $y`
c="LIPID "$i
d="LIPID "$Result
echo $c
echo $d
e="'s/"$c"/"$d"/g' MCdemo.txt"
f="sed "$e
$f

done



This is the error:

sed: -e expression #1, char 1: unknown command: `''

Could someone please point out what is going wrong...
disruptive is offline  


Reply With Quote
Old 06-29-2006   #2 (permalink)
Linux User
 
muha's Avatar
 
Join Date: Jan 2006
Posts: 290
hiya, why not loose the f= and the $f part and just put in sed $e ???
The last part of your script would look like:
Code:
e="'s/"$c"/"$d"/g' MCdemo.txt"
sed $e
__________________
Now what? You have Linux installed and running. The GUI is working fine, but you are getting tired of changing your desktop themes. You keep seeing this "terminal" thing. Don't worry, they'll show you what to do @
<~ http://www.linuxcommand.org/ ~>
muha is offline   Reply With Quote
Reply


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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 11:07 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2