FTP decoding


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting FTP decoding
# 1  
Old 06-23-2014
FTP decoding

I am trying to understand a UNIX script which FTPs certain files from a remote location to the local machine. I understand the basic FTP command but the UNIX script uses the following command:
Code:
ftp -n -i -v > $logftp_trg 2>&1 <<!
open $MFX_FTP_SERVER
user $MFX_FTP_LOGIN $MFX_FTP_PWD

Can anyone explain me the step by step working of these commands.

Last edited by Franklin52; 06-24-2014 at 07:01 AM.. Reason: Please use code tags
# 2  
Old 06-23-2014
That isn't a traditional ftp client you are using. What is the O/S you are using and what is the type of ftp client.

Traditional ftp allows the use of a .netrc file to automate ftp operations.

If possible, I recommend using ssh / sftp.
# 3  
Old 06-25-2014
Quote:
Originally Posted by blackrageous
That isn't a traditional ftp client you are using. What is the O/S you are using and what is the type of ftp client.
A standard Unix or Linux ftp client supports all the given command line options and the two given commands. Not sure why you claim it is not a traditional ftp client.

To the OP, you have only provided us with a part of the ftp client script. The first line invokes FTP with a number of arguments. Look at an ftp man page for an explanation of the n,i,v arguments. "> $logftp_trg 2>&1" means save STDOUT and STDERR to a file specified by the variable "logftp_trg". "<<!" is the start of a shell here document.

The second line invokes the ftp command "open" with the host to open specified by the variable MFX_FTP_SERVER

The third line invokes the ftp command "user" with the username and password to be send to opened host specified by the variables MFX_FTP_LOGIN and MFX_FTP_PWD respectively.

Where are all these variables are being set? Either in a previous part of the script or they are in your environment.

Last edited by fpmurphy; 06-25-2014 at 12:19 AM..
# 4  
Old 06-25-2014
Thanks Fpmurphy for the explanation. I got what you explained except one part. What is the use of "<<!" in ftp -n -i -v > $logftp_trg 2>&1 <<!
. Also does '$logftp_trg 2>&1' simply inserts the oupt into the file specified by $logftp_trg. If we want to send the STDOUT and STDERR in the file shoudn't it be like '2>&1>$logftp_trg'
# 5  
Old 06-25-2014
Here Documents

In this case, the limit string is !, and your heredoc is a bunch of commands for FTP. Someplace further down you should have a line that consists only of !, which terminates the heredoc.
# 6  
Old 06-25-2014
Quote:
Originally Posted by Bhavesh Sharma
If we want to send the STDOUT and STDERR in the file shoudn't it be like '2>&1>$logftp_trg'
No. You are incorrect. Read your shell man page for an explanation of ">&" syntax.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

ASN1 decoding error

Hi, fellows i am modifying asn1 schema to be able to decode a file, but i am hitting a error on one of the fields using free online tool asn1-playground. I suspect i need to change type and have tried with IDENTIFIER but it doesn't help...any ideas check the schema and file down , please ... (0 Replies)
Discussion started by: tahchiev01
0 Replies

2. Shell Programming and Scripting

Decoding and pattern matching

Hello, I have a huge file with over 700,00 SNPs with 18 columns. One column is in the format --+-+ ---++ ????? -???? Now i have another list which corresponds to this code in a particular order A-1 B-7 C-11 D-3 E-100 Now I need to match the expression above to the pattern,... (1 Reply)
Discussion started by: nans
1 Replies

3. Web Development

Random - Any help decoding obfuscated code?

I have this following file and I would quite like to get it decoded - any help / advice is appreciated. I would like to know how to decrypt it, however if someone is able to do it for me I would be equally grateful. <?php //Obfuscation provided by FOPO - Free Online PHP Obfuscator v1.2:... (6 Replies)
Discussion started by: mcclunyboy
6 Replies

4. Shell Programming and Scripting

[Solved] Decoding a base 64 string

Is it possible to decode a base 64 string in linux or unix. If so, related commands or reference notes would be really helpful. (1 Reply)
Discussion started by: chandu123
1 Replies

5. UNIX for Dummies Questions & Answers

Decoding a string

Hi, If my input string is 3a3b4c then my result should be aaabbbcccc. Please guide me how to achieve this in a bash script. Thanks (18 Replies)
Discussion started by: pandeesh
18 Replies

6. UNIX for Dummies Questions & Answers

URL decoding with awk

The challenge: Decode URL's, i.e. convert %HEX to the corresponding special characters, using only UNIX base utilities, and without having to type out each special character. I have an anonymous C code snippet where the author assigns each hex digit a number from 0 to 16 and then does some... (2 Replies)
Discussion started by: uiop44
2 Replies

7. IP Networking

Packet decoding

Hi, wondering if anyone can suggest a tool to me that will let me either cut & paste hex or type it in for packet decoding. I want to be able to decode a packet as done with tcpdump or wireshark, but I want to be able to manually input the hex myself. (2 Replies)
Discussion started by: Breakology
2 Replies

8. Shell Programming and Scripting

decoding URL encoded strings

Hi, I have a couple pages of URL encoded strings that I need to unencode (they were originally in Arabic). So the first step is to unencode the strings and then to translate them to English. They are actually lists of words so the translation from Arabic to English shouldn't be too complicated.... (1 Reply)
Discussion started by: ed111
1 Replies

9. Shell Programming and Scripting

decoding commands

hi please can anyone help me in decoding shell commands. i need a way to decode the encrypted shell commands. (8 Replies)
Discussion started by: rochitsharma
8 Replies

10. Programming

Decoding of Core Dump

Hi ALL, Is it possible to decode the core dumb file to find the error? I get an Memory Core Dumb error with an core file. Regards, P. Prathaban. (3 Replies)
Discussion started by: p_prathaban
3 Replies
Login or Register to Ask a Question