Quote:
Originally Posted by
ali560045
i have a script called file2
#!/bin/ksh
i=0
while [ $i -lt 5 ]
do
echo $i >> result.txt
i=`expr $i + 1`
done
echo "***********************" >> result
-------------------------------------------------------------------
Just my 2c:
@ali - you posted the above code & asked why during multiple runs, the result gets appended instead of being overwritten.
Do you know, what is the difference between ">>" & ">" is?
If you do, then no need to ask the question.
If you don't, then do "man ksh" & check the "Input/Output" section.
This forum is for helping people who are stuck somewhere. There is an assumption that you have tried on your own, did some reasonable reading of manpages etc. and still couldn't get it to work.
The question you asked is taught in page 1 of shell scripting school. It doesn't appear to me that you have even done some reading on basics of shell scripting (which is freely available in hundreds of webpages). We are more than glad to help but not to spoon-feed. If we work to help you, you also have to demonstrate that you worked yourself.
If you don't understand about something someone posts, check what you don't understand & ask "specifically" what you don't understand. Simply something like "I don't understand what you are saying" really doesn't help & irritates someone who worked to help you.
As far as language etc. is concerned, I will only say that it is better to use basic English & avoid shortcuts/abbreviations etc.
Nothing personal against you so please don't feel bad.