Your script in post #1 has a layout problem.
The terminating string END_OF_SESSION MUST start in column one. i.e. Don't indent that line.
Also, you don't set a value for $FILETYPE . Presumably it would be ascii rather than binary .
The long command version does not produce valid ftp syntax.
The "EOT" and "&&" are totally surplus and should not be there.
The server=".... commands..." construct is faulty.
It's just a string assignment. It never executes any commands.
The executable bit needs backticks: server=`".... commands..."`
Both the backticks and the double quotes are needed. It is well worth reading up on the various quote characters until you understand them. Remember that within single quotes no variables are expanded at all.
The server= version of your script does not set the file type (ascii/binary). This will cause problems with your filenames (because they are not .txt) unless you set it correctly.
When posting Shell Scripting problems, please always post what Operating System and version you are running and what Shell you are using.
There may be more modern Posix syntax for executing commands in a string assignment depending on what Shell you have.
What i need is a way to conect to a ftp account and send some files automatically.
Now how this can be done in command line? I need to reproduce this in a command line and then put inside a system() to execute in a c program running ubuntu 12.04
Try creating and testing a script, then executing that script from the C Programming Language system() call.
It will drive you nuts trying to get a one-liner to work in this situation.
Off topic.
Why?
mput *
mput *.*
If the source system is a unix system, the MSDOS 8.3 file naming convention is irrelevant. The mput * should be sufficient.
The problem is i cant left open the information about server name, login and password to everyone see it. That's why i need to convert this command in one terminal command line.
yeah, this script was originally for DOS, dont really need the second line.