Problem in making a script

amritpal pathak amritpalpathak1 at gmail.com
Thu Jun 30 10:15:11 UTC 2011


On Thu, Jun 30, 2011 at 4:37 AM, Nils Kassube <kassube at gmx.net> wrote:

> amritpal pathak wrote:
> >                                                                But
> > still i am little bit confuse to understand it "how it is
> > happening".Please sir,tell me what each line is doing .It will make
> > me fully understand it
> >
> > TEMP=$(mktemp)
>
> Make a temporary file which doesn't conflict with existing files.
>      means temporary file with same name as original?
> > head -n $((4 - 1)) "abc.tex" > "$TEMP"
>
> Copy the first lines from the original file to the temporary file.
>  ok first 3 line here will be copy to temp file.
> > echo "$fname" >> "$TEMP"
>
> Append the user input to the temporary file.
>  i.e at line 4
> > LEN=$(cat "abc.tex"|wc -l)
> > tail -n $(($LEN - 4)) "abc.tex" >> "$TEMP"
>
> Append the remaining lines from the original file to the temporary file.
>  ok
> > mv "$TEMP" "abc.tex"
>
> Replace the original file by the temporary file.
> ok
>

     Thanks you very much.

> If you want to learn more about the individual commands, please read the
> man pages:
>
> man mktemp head echo cat wc tail mv
>
>  ok .i will.
>

   amritpalpathakgne.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20110630/807e411d/attachment.html>


More information about the ubuntu-users mailing list