Sponsored Content
Full Discussion: Interactive ftp get/put
Top Forums Shell Programming and Scripting Interactive ftp get/put Post 302317130 by darrenm on Monday 18th of May 2009 06:34:19 AM
Old 05-18-2009
Interactive ftp get/put

Hi All,

I'm trying to get this to work but when I execute it I get the following error

./ftp_upload.sh: line 78: syntax error: unexpected end of file.

This was working before I expanded the script and had the here document part directly below within a function.

Can anyone spot what I've done wrong.

Cheers,

Darren.

Code:
       lftp $Server $Portnum <<End-Of-Session
"$1" "$filename"
bye
End-Of-Session



Code:
#!/bin/bash
######################################################################
#                               Validation
######################################################################
E_ARGERROR=85
if [ -z "$2" ]
then
echo "Usage: `basename $0` Filename-to-upload"
exit $E_ARGERROR
fi ###################################################################### # Defaults ###################################################################### Server=${Server:-10.77.40.237} Portnum=${PortNum:-21} ###################################################################### # Functions ###################################################################### #~~~Manually enter paramaters, export or set in this file ftp_interactive #to false to prevent this ftp_interactive=${ftp_interactive:-true} function confirm() { if [ "$ftp_interactive" == "true" ]; then
eval confirm_contents=\$$1
read -p "Confirm value for \$$1 [$confirm_contents] "
confirm_input
if [ "$confirm_input" != "" ]; then
eval $1="\"$confirm_input\""
fi
fi } function options(){
echo "Valid options for this are:"
for i in $*
do
echo " [$i]"
done
} function execution(){
lftp $Server $Portnum <<End-Of-Session
"$1" "$filename"
bye
End-Of-Session
} ###################################################################### # Execution ###################################################################### echo "Please enter a valid ftp servers IP address" options 10.77.40.237 confirm Server echo "Enter your ftp servers port number" options 21 confirm Portnum filename=$2 if [ "$1" == "get" ]; then
execution get
else
execution put
fi exit 0


Last edited by darrenm; 05-18-2009 at 08:01 AM.. Reason: indenting text
 

10 More Discussions You Might Find Interesting

1. Solaris

script to performm interactive ftp

hi, i have to generate a script, which performs FTP action. The script should handle both put and get functions. can anybody help me on hw to develop the script (1 Reply)
Discussion started by: prash_b
1 Replies

2. UNIX for Advanced & Expert Users

Put fails during FTP

Hi All, I am facing a while i use mput to the server. Actually i have data on client machine which is windows XP. The data is near to 1GB. I have zipped the data. I can ftp and connect to Server(Which has Fedora 4 running). but when i do mput *.zip it gives an error. I tried to put in a... (2 Replies)
Discussion started by: prakash.kudreka
2 Replies

3. Shell Programming and Scripting

put an interactive script in background after taking input

i am trying to find a way to put an interactive script in the background after taking input from the user a few test lines i was trying: date echo "Enter location" LOCATION= read LOCATION sleep 100 sleep 200 date for this small example i want the script to as the user for the... (7 Replies)
Discussion started by: epsilonaurigae
7 Replies

4. Shell Programming and Scripting

how to put file from one ftp to another ftp location

hi, I have one file located in ftp.I want to place that file in different ftp location. Up to now i am doing it manually using get command and copying that file in to my local system and then putting that file in different ftp using put command. now i want to automate that using shell... (1 Reply)
Discussion started by: prasee
1 Replies

5. HP-UX

Ftp cannot put file larger than 64kb

Hi gurus, I have a problem with ftp access. The first 2 test e.g. Test A & Test B was successful with the file size 64kb (800++ numbers). The third test with file size 120kb was failed. The error is "Netout :Connection reset by peer". No password entered manually since the test run from the... (3 Replies)
Discussion started by: yeazas
3 Replies

6. UNIX for Dummies Questions & Answers

FTP put command problem

Hello,I am trying to put something on the ftp server using the put command. Whenever I try, I get this error: ftp> put SIMS.war local: SIMS.war remote: SIMS.war 200 PORT command successful 553 Can't open that file: Permission denied I have set rwx for all on that file and I still am... (3 Replies)
Discussion started by: mojoman
3 Replies

7. Shell Programming and Scripting

Status of FTP Put command

Can i capture the status of put command after i ftp a file? (4 Replies)
Discussion started by: aixjadoo
4 Replies

8. Shell Programming and Scripting

Non-interactive FTP within SSH session not working

Hello everyone! I am trying to log-in to a remote server over SSH, transfer file1 there, perform some checks, capture the results in file2 and transfer file2 back to my local server - all of this non-interactively. Initially, I tried to do this within a singe SSH session, using the following... (2 Replies)
Discussion started by: Subu1987
2 Replies

9. Shell Programming and Scripting

Hebrew character convert error while put thru ftp

Hi all , i have a script which cp xml files from linux to other server thru ftp my xml file contains charcters in hebrew . my script is #!/bin/bash HOST="....." USER="....." PASSWORD="..." cd /usr2/app/naama/ filelist='find . -mmin -60 | tail -n +2 | awk -F "/" '{print $2}' | grep xml'... (3 Replies)
Discussion started by: naamas03
3 Replies

10. UNIX for Beginners Questions & Answers

How to see the status of all the ftp put & get files logs and curent ftp transfer status ?

How to see the status of all the ftp put & get files logs and curent ftp transfer status if any active ftp running in the background ? (2 Replies)
Discussion started by: i4ismail
2 Replies
GIT-SH-SETUP(1) 						    Git Manual							   GIT-SH-SETUP(1)

NAME
git-sh-setup - Common git shell script setup code SYNOPSIS
. "$(git --exec-path)/git-sh-setup" DESCRIPTION
This is not a command the end user would want to run. Ever. This documentation is meant for people who are studying the Porcelain-ish scripts and/or are writing new ones. The git sh-setup scriptlet is designed to be sourced (using .) by other shell scripts to set up some variables pointing at the normal git directories and a few helper shell functions. Before sourcing it, your script should set up a few variables; USAGE (and LONG_USAGE, if any) is used to define message given by usage() shell function. SUBDIRECTORY_OK can be set if the script can run from a subdirectory of the working tree (some commands do not). The scriptlet sets GIT_DIR and GIT_OBJECT_DIRECTORY shell variables, but does not export them to the environment. FUNCTIONS
die exit after emitting the supplied error message to the standard error stream. usage die with the usage message. set_reflog_action set the message that will be recorded to describe the end-user action in the reflog, when the script updates a ref. git_editor runs an editor of user's choice (GIT_EDITOR, core.editor, VISUAL or EDITOR) on a given file, but error out if no editor is specified and the terminal is dumb. is_bare_repository outputs true or false to the standard output stream to indicate if the repository is a bare repository (i.e. without an associated working tree). cd_to_toplevel runs chdir to the toplevel of the working tree. require_work_tree checks if the current directory is within the working tree of the repository, and otherwise dies. require_work_tree_exists checks if the working tree associated with the repository exists, and otherwise dies. Often done before calling cd_to_toplevel, which is impossible to do if there is no working tree. require_clean_work_tree <action> [<hint>] checks that the working tree and index associated with the repository have no uncommitted changes to tracked files. Otherwise it emits an error message of the form Cannot <action>: <reason>. <hint>, and dies. Example: require_clean_work_tree rebase "Please commit or stash them." get_author_ident_from_commit outputs code for use with eval to set the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL and GIT_AUTHOR_DATE variables for a given commit. GIT
Part of the git(1) suite Git 1.7.10.4 11/24/2012 GIT-SH-SETUP(1)
All times are GMT -4. The time now is 03:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy