0

I have a variable that am declaring like below in my shell script:

Variable = awk 'Some code' filename.txt << this is assigning one word from the text file to this variable

And then am trying to display this in an HTML heading like below, but its not working.

<h2><font color="navy"> Network-element : ${variable} </font></h2>

any help is appreciated.

1 Answer 1

1

I think there could be 2 points here.

1- Cover the variable value like:

Variable=$(awk 'Some code' filename.txt)

2- Then in shell script html code doesn't work like simple print you have to use echo for it (NOTE this is only an example)eg->

echo "<html>" > $OUTPUT_FILE
echo "<title>" >> $OUTPUT_FILE
echo "A Test script." >> $OUTPUT_FILE
echo "</title>" >> $OUTPUT_FILE
echo "</body>" >> $OUTPUT_FILE
echo "</html>" >> $OUTPUT_FILE

This above code is only an example where I am putting echo statements into output file. You could use it as per your use case. Also use "$Variable" in echo command.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for it, that's what was needed and it worked perfectly:)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.