Re: Problem in making a script
- From: Nils Kassube <kassube@xxxxxxx>
- Date: Thu, 30 Jun 2011 10:37:21 +0200
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
- Follow-Ups:
- Re: Problem in making a script
- From: amritpal pathak
- Re: Problem in making a script
- References:
- Problem in making a script
- From: amritpal pathak
- Re: Problem in making a script
- From: Nils Kassube
- Re: Problem in making a script
- From: amritpal pathak
- Problem in making a script
- Prev by Date: Re: How to give overwrite or overiding permission ?
- Next by Date: Re: Printer Drivers missing on Lucid
- Previous by thread: Re: Problem in making a script
- Next by thread: Re: Problem in making a script
- Index(es):
Relevant Pages
|