Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am facing some problems in replacing the value of a variable in a html tag in a unix box. Here are the details. Please help me in finding a solution.

#!/bin/ksh

count=5

line="<td>$count</td>"

echo "$line"

I am expecting the output to be <td>5</td> but I am getting the output as <td>$count</td>.

I tried a lot to solve this but couldn't :(

share|improve this question
    
Your likely problem is that ksh doesn't do variable expansion the same way bash does. –  Shadur Sep 23 '11 at 9:43
1  
The script you posted does output <td>5</td>. Did you copy-paste the right script? How are you running it? –  Gilles Sep 23 '11 at 21:55
add comment

1 Answer

I'm not an expert on ksh but according to the documentation, the following should work (if slightly clunky):

echo -n "<td>" 
echo -n ${count} 
echo "</td>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.