I want to create a simple file....with the command

Example:

touch file.txt

ok its created *BUT*

****I want to edit this file in shell and save it, writing EOF to finish.

Any suggestions? How i do that? Thanks!

You'd better post shell scripting related kind of threads here
any way ,you can edit it like this

cat > file.txt
Hello, I am a linux user myself.
EOF

and press [ctrl]+[c] keys to save it.
And if you want to use c for that purpose.then

#include <stdio.h>
int main(){
FILE* fptr;
if((fptr=fopen("file.txt","w"))==NULL)
    return 1;
fputs("I am a linux user myself\n",fptr);
fclose(fptr);
return 0;
}

And you don't need to write the word "EOF" to make c able to know where your file ends, if that's what you're trying to do.

You'd better post shell scripting related kind of threads here
any way ,you can edit it like this

cat > file.txt
Hello, I am a linux user myself.
EOF

and press [ctrl]+[c] keys to save it.
And if you want to use c for that purpose.then

#include <stdio.h>
int main(){
FILE* fptr;
if((fptr=fopen("file.txt","w"))==NULL)
    return 1;
fputs("I am a linux user myself\n",fptr);
fclose(fptr);
return 0;
}

And you don't need to write the word "EOF" to make c able to know where your file ends, if that's what you're trying to do.

Thankss ur the best!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.