Re: Problem in making a script



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.

head -n $((4 - 1)) "abc.tex" > "$TEMP"

Copy the first lines from the original file to the temporary file.

echo "$fname" >> "$TEMP"

Append the user input to the temporary file.

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.

mv "$TEMP" "abc.tex"

Replace the original file by the temporary file.

If you want to learn more about the individual commands, please read the
man pages:

man mktemp head echo cat wc tail mv


Nils

--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users