i want a script to check whether the file name exits or not if not it has to create a new one
What did you try so far..??
test -e fff.txt || touch fff.txt
It will create an empty file fff.txt if it doesn't exist.
Other thing when you use cat > <file> It also create the file if is not present and if it present it over writes the contents.
This sounds like homework.
I would also like to know what you tried so far.
For what it's worth, the answer is in siba.s.nayak's post, although it is a lot less complicated than what siba indicated.