Create File

Hello,
I am new to shell scripting. Can anyone plz tell me that how to write script
to create the file and insert the data into it.

    what i am doing is in script i have written

    cat > path.txt

     but when i execute the script it doesnt get exited from script explicitly
     i have to say ctrl\+d. then only it works..Can nyone plz help me

What do you want to put in the file (what data)?

echo something > path.txt

Using cat as you did, you can type anything you like before pressing control-d and that will go in the file.

I want to put path names of deleted files...

Can you please let me know , how u finding the deleted file .. is it form some file or thru some command ,

Please provide step by step what u are doing manually.

then we can help u to create script

Thank you so much arunkumar for your reply.....

what I am doing is I have written delete script. in which I am simply moving deleted files to backup directory..& in this script only I have created one path.txt file in which i am storing the deleted files path..

Now I have written one script restore in which if i will say restore in will show me all the files in following format.....
mc09aa:0:/home/workdone/deletedfile1

mc09aa:1:/home/workdone/deletedfile2

mc09aa:3:/home/workdone/deletedfile3

now my concern is if i will say restore 1...In this case deletedfile2 should be get restore to its original location....Can u please help me for writting script

In your script, you just need to add a line like

echo $name_of file_you_moved >> path.txt

The problem will be that at restore time, you'll have to delete the line you created when you "deleted" the file, isn't it?

Ya U r right...but how I can restore it to Its original location.

It is against forum rules to write like this:

U r right

Please use proper language and grammar. This is not a chat room.

And the translation in other languages gives imprevisible results :smiley:

Extremely sorry for the language I used...Its because of chatting habit...I will never repeat it again...:frowning: