Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Sftp transfers file partially Post 303027090 by Asad on Sunday 9th of December 2018 12:39:34 AM
Old 12-09-2018
Sftp transfers file partially

Hi ALL,

I have a shell script using except :

Code:
#!/bin/bash
 HOST=abc.com
 USER=abc
 PASSWORD=123
 SOURCE_FILE=file1.zip
 TARGET_DIR=/A/B/C

 /usr/bin/expect <<- EOF

 spawn /usr/bin/sftp $USER@$HOST
 expect "password:"
 send "$PASSWORD\r"
 expect "sftp>"
 send "cd patch1\n"
 expect "sftp>"
 send "pwd\r"
 expect "sftp>"
 send "get $SOURCE_FILE $TARGET_DIR\r"
 expect "sftp>"
 send "bye\r"
EOF

Once I execute the script using it only transfer 20 MB of the file

While if I transfer the file manually the size of file transffered in 80 MB

Therefore the shell script is somehow doesnot wait for send to complete .

Can you all suggest some way to overcome this problem .

Thanks,
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

reas a file partially line by line

I need to read a file fron nth to n+m line by line using bash ie while read line do # soem stuff done <<file But The file is so big I am only intersted in reading ceratin portion of the file ie from nth line to mth line where m is alwasy greatr than n (2 Replies)
Discussion started by: jojan
2 Replies

2. Shell Programming and Scripting

How to partially replace variable value?

I have variable $2 whose value is expdp_SDW_MSTR_VMDB.par I want to replace three characters from right (par) with (log) Input --> expdp_SDW_MSTR_VMDB.par Output --> expdp_SDW_MSTR_VMDB.log Thanks Deep (2 Replies)
Discussion started by: deep.singh
2 Replies

3. UNIX for Advanced & Expert Users

tunneling commands and file transfers through established ssh connection

Hi - I frequently run commands, and transfer files to/from a host that uses SecurID ssh authentication. It is a real pain to have to enter the authentication information every time I want to interact with this host. I am wondering if there is a way to establish a one-time ssh connection to this... (2 Replies)
Discussion started by: cpp6f
2 Replies

4. Shell Programming and Scripting

Is it possible to partially clear the terminal?

The clear command specifically says it can only clear the entire terminal display. There are no arguments. So I'm wondering if there are any work arounds. Carriage return does not work for this as it only moves the cursor to the beginning of the line we're on. And obviously NL only goes down. If... (1 Reply)
Discussion started by: FunkyLich
1 Replies

5. Shell Programming and Scripting

How to output the partially equals

Hello i have 2 files: a.out 10.1.1.1 james.franco 10.1.1.3 google.gol 10.1.1.14 yahoo.bol b.out 10.1.1.1 10.1.1.3 10.1.1.45 I need to see an output just with: 10.1.1.1 james.franco 10.1.1.3 google.gol Thankz in advance!! (2 Replies)
Discussion started by: danielldf
2 Replies

6. Programming

Automatic SFTP transfers using OpenSSH on Windows and C#

I would like to create console application in c# to automate the process of downloading some files from a SFTP server to my local hard drive at a set time each week/day. SFTP Server installed OpenSSH for windows and client machine also. Any ideas how I could do such a task? or sample code. ... (0 Replies)
Discussion started by: sufiiyan
0 Replies

7. UNIX for Dummies Questions & Answers

Script partially executes??

Hi All, I am calling a shell script from another shell script, however, it only executes part of it (the echo commands only). What could be some causes for that? For example: ShellScriptA.sh: ... ... ... . ShellScriptB.sh ShellScriptB.sh contents: echo date echo... (7 Replies)
Discussion started by: DBnixUser
7 Replies

8. Shell Programming and Scripting

Command / script to partially rename file

Hi I have numerous files names product_host_result_B1000842.txt product_host_result_B1000847.txt product_host_result_C1000842.txt product_host_result_C1000848.txt etc. I need them renamed so that the 'product_host_result' becomes 'output_product_host' but the rest of the filename is... (6 Replies)
Discussion started by: Grueben
6 Replies

9. Shell Programming and Scripting

Identify failed file transfers during SFTP

Hi All, I have a pretty demanding requirement for an SFTP script I have been trying to put together. I have nearly 100 files (all with the names staring with T_PROD) generated in my local server daily. I need to transfer each of these files to a remote server via SFTP (that's a client... (6 Replies)
Discussion started by: Aviktheory11
6 Replies

10. Shell Programming and Scripting

Pls Help: SFTP Error Handling for transfers

I am working on a shell script where after making sftp connection to a remote server the file are being transferred. The problem is how to capture return code for the file which is missing at the remote location. I have tried to capture the return code which return value of "0" even the transfer of... (4 Replies)
Discussion started by: Khan28
4 Replies
getusershell(3C)					   Standard C Library Functions 					  getusershell(3C)

NAME
getusershell, setusershell, endusershell - get legal user shells SYNOPSIS
#include <unistd.h> char *getusershell(void); void setusershell(void); void endusershell(void); DESCRIPTION
The getusershell() function returns a pointer to a legal user shell as defined by the system manager in the file /etc/shells. If /etc/shells does not exist, the following locations of the standard system shells are used in its place: /bin/bash /bin/csh /bin/jsh /bin/ksh /bin/ksh93 /bin/pfcsh /bin/pfksh /bin/pfsh /bin/sh /bin/tcsh /bin/zsh /sbin/jsh /sbin/pfsh /sbin/sh /usr/bin/bash /usr/bin/csh /usr/bin/jsh /usr/bin/ksh /usr/bin/ksh93 /usr/bin/pfcsh /usr/bin/pfksh /usr/bin/pfsh /usr/bin/sh /usr/bin/tcsh /usr/bin/zsh /usr/sfw/bin/zsh /usr/xpg4/bin/sh The getusershell() function opens the file /etc/shells, if it exists, and returns the next entry in the list of shells. The setusershell() function rewinds the file or the list. The endusershell() function closes the file, frees any memory used by getusershell() and setusershell(), and rewinds the file /etc/shells. RETURN VALUES
The getusershell() function returns a null pointer on EOF. BUGS
All information is contained in memory that may be freed with a call to endusershell(), so it must be copied if it is to be saved. NOTES
Restricted shells should not be listed in /etc/shells. SunOS 5.11 1 Nov 2007 getusershell(3C)
All times are GMT -4. The time now is 02:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy