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

Bash Scripting



hi all

i need a little help on a script. the following scripts function is to merge 
several parts of a html page together and insert a new piece of text from 
text.txt also it has to replace some words (the title, author, submittor, and 
date) with the words given at prompt.

---------
#!/bin/bash
echo Please give the title, author, submittor, date and filename
read TITLE AUTHOR SUBMITTOR DATE FILENAME

cat top.html >> file.txt &&

sed  's/Title/$TITLE/' title.html >> file.txt &&
sed  's/Author/$AUTHOR/' author.html >> file.txt &&
sed  's/SM/$SUBMITTOR/' submittor.html >> file.txt &&

cat text.txt >> file.txt &&

sed  's/Date/$DATE/' bottom.html >> file.txt &&
mv file.txt new_$FILENAME.html
---------
(i'm aware that its crude and basic, but i'm not familar with scripting for 
bash though i'm working through the HOWTO)

the problem is that the variables TITLE AUTHOR SUBMITTOR DATE are not 
replaced with the inputted values, where as FILENAME is so i must have the 
synax wrong the "/"s perhaps?



Reply to: