[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bash Scripting



> | > sed  's/Title/$TITLE/g' title.html >> file.txt &&
>
>          ^                ^
> The single quotes are a problem too.  Bash doesn't do any variable
> expansion in single quotes.  ($TITLE will still be $TITLE for sed)
>
> Instead:
>
> sed  "s/Title/$TITLE/g" title.html >> file.txt &&
>
> Also, I'm not sure why you have double & at the end of the line.  I
> think you want to run sed in the foreground, not the background.  I
> don't understand what the second & does.

heh, ofcourse.. 

> | I think the g is missing, that is all I noticed
>
> You only need the g if the text to replace occurs more than once on a
> line.  If it doesn't, it doesn't matter.  If it does, do you want to
> replace all occurences or just the first?

its just a one time one word replace..

> BTW,  I don't use bash scripting for anything other than running
> programs with some default options.  I would prefer to use python for
> this sort of thing, but it's up to you what you want to use.

..let the newbie get used to bash first okay? ;)

Cheers,

William



Reply to: