11.07.2015 Views

NetEx EFT213 Reference Manual Rel 5.4

NetEx EFT213 Reference Manual Rel 5.4

NetEx EFT213 Reference Manual Rel 5.4

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using String Functions within a <strong>NetEx</strong>/eFT ScriptIn order to gain even more flexibility, a script can be designed to use positional parameters if they are passed,and to prompt for input in the absence of positional parameters. This added feature of scripting makes use of<strong>NetEx</strong>/eFT string functions. (See the section entitled “String Functions” on page 66 for a more detailed discussion.)In the sample below, the string function ndf(), (if Not DeFined), is used. ndf() tests its first argument (variable1, 2, 3, or 4) to see if it’s defined. If it’s not, ndf() executes its second argument (ASK -prompt ...). If argument1 is defined, ndf() executes argument three (optionally left out). The new definition of theTRANSFER script is:* This is a sample TRANSFER script that uses String Functions*{ndf(1, "ask -prompt ""Transfer being made to what host? "" 1")}{ndf(2, "ask -prompt ""User ID on host {1}? "" 2")}{ndf(3, "ask -secure -prompt ""Password for user {2}? "" 3")}{ndf(4, "ask -prompt ""File to be transferred? "" 4")}connect -quiet {1} {2} {3}send -quiet {4}text ***********************text File '{4}' has been transferred to {1}.text ***********************disconnect -quietThe logic of the script when invoked is:• If no parameters are on the TRANSFER command line, prompt the user for all four pieces of informationand read them into variables 1, 2, 3, and 4.• If one parameter is passed, use it as variable 1 (Host), and prompt for the other three.• If a second parameter is passed on the TRANSFER command line, use it as variable 2 (User id), andprompt for the third and fourth variables.• If three parameters are passed on the command line, read them into variables 1, 2, and 3 (Password)respectively and prompt only for the fourth variable.• If four parameters are passed on the command line, read them into variables 1, 2, 3 and 4 (file)respectively, and do not prompt at all.• Finally, execute the remaining commands, substituting the variables or parameters as needed.The following is an example execution of the TRANSFER script with two parameters passed to it:eFT> transfer BLUESKY guestPassword for user guest? _____File to be transferred? tmpfile***********************File 'tmpfile' has been transferred to BLUESKY.***********************eFT>Since two parameters were passed, the script prompted only for the last two. Scripts like this one are especiallyuseful when there is a need to run both interactively and in batch. Batch jobs require all the parametersto be defined since they cannot prompt for user input.REF-eFT213-R<strong>5.4</strong>-08 Advanced Local User’s Guide Page 93

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!