<br><br><div class="gmail_quote">On Sat, Jul 2, 2011 at 7:21 AM, Nils Kassube <span dir="ltr"><<a href="mailto:kassube@gmx.net">kassube@gmx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Amrit Pal Pathak wrote:<br>
> On Sat, Jul 2, 2011 at 5:07 AM, Nils Kassube <<a href="mailto:kassube@gmx.net">kassube@gmx.net</a>> wrote:<br>
</div><div class="im">> > You could extend the echo command with the rest of the text you<br>
> > need in the line. Something like this:<br>
> ><br>
> > echo -n "Please enter device name: "<br>
> > read device<br>
> > ...<br>
> > echo "device = /dev/$device" >> "$TEMP"<br>
> ><br>
>   Here $TEMP is temporaily file name?<br>
<br>
</div>Yes. At the line "..." I omitted the creation of that temp file etc.<br>
because I wanted to show how to use the echo command with the user input<br>
appended to the extra text.<br>
<div class="im"><br>
>       Can I use here a variable then can replace $fname with<br>
>      that variable in following code.<br>
<br>
</div>I'm not sure what you want to ask here. Anyway, you can name a variable<br>
whatever you want. It doesn't matter if it is "fname" or "device" or<br>
"donaldduck". It is only important that you later use the right variable<br>
when you write to the conf file. Of course it is much easier to<br>
understand the code if you use a variable name which tells you something<br>
about the designated contents. I was using "device" for clarity because<br>
the user input was a device name. I would expect some file name in a<br>
variable "fname" but feel free to use "fname" instead of "device".<br>
<div class="im"><br>
> sudo wget <a href="http://202.164.53.116/~amritpal/edit/kannel.conf" target="_blank">http://202.164.53.116/~amritpal/edit/kannel.conf</a><br>
> sudo chmod a+w kannel.conf<br>
<br>
</div>While these lines have nothing to do with your original question, I'll<br>
comment on them anyway. These lines are a bit strange because first you<br>
use sudo to wget a file, and then you change the permissions to make the<br>
file world writeable. If you don't use sudo for the wget command, you<br>
don't need to change the permissions afterwards.</blockquote><div>      I think you said reverse.Your meaning might "if you use sudo for wget a file ,there is no need to change the permissions".</div><div>May be i am wrong.</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> Never use sudo unless<br>
you really know it is needed.<br>
<div class="im"><br>
> echo -n "Please enter device name: "<br>
> read device<br>
> echo "device = /dev/$device" >> "$TEMP"<br>
   Yes you was right.</div></blockquote><div>       My stupidity.!!!</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Well, that line is in the wrong place. You can't write to a temporary<br>

file before you create it. If you have used the TEMP variable before,<br>
you might write to the wrong file. If it wasn't used before, it would<br>
simply be a syntax error.<br>
<div class="im"><br>
> TEMP=$(mktemp)<br>
> head -n $((29 - 1)) "kannel.conf" > "$TEMP"<br>
> echo "$fname" >> "$TEMP"<br>
<br>
</div>Replace this line with the one that was in the wrong place above.<br>
<div><div></div><div class="h5"><br>
It worked.</div></div></blockquote><div>   Thank you  very much Sir</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5"><a href="http://amritpalpathakgne.wordpress.com">amritpalpathakgne.wordpress.com</a> </div>
</div></blockquote></div>