|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
Passing variables: sftp using -b batchfile
Hi All,
I have created a script for an sftp transfer that works without a date variable being passed, I want it to work with a date variable being passed. So, my initial script, mainsftp.sh, looks like this: ----------------------------------------------------------------------- # Variables # ODAY=$1 LDIR1='/sftp/incoming' USER1=username MACHINE1=nnn.nnn.nnn.nnn # Main sftp -b ~/folder/sftpcmd.txt $USER1@$MACHINE1 <<EOF ----------------------------------------------------------------------- File sftpcmd.txt looks like this: ---------------------------------------------------------------------- lcd /ftp/dir get filename_*.csv get filename_*.txt bye ---------------------------------------------------------------------- Now - the above code works for me and will retrieve all files filename_*.csv and filename_*.txt however, for the purposes of my job, I want to change sftpcmd to look as follows, with $ODAY being passed as $1 to the main script: ---------------------------------------------------------------------- lcd /ftp/dir get filename_$ODAY.csv get filename_$ODAY.txt bye ---------------------------------------------------------------------- My question is two-fold: a) Is there a way to have the ftp commands in the batchfile above within mainsftp.sh? or if not b) Is there a way to pass the $ODAY variable from mainsftp.sh to sftpcmd.txt I'm working on an AIX server. Thanks, Julie |
| Sponsored Links | ||
|
|
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Tags |
| aix, sftp |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sftp -b doesn't read the batchfile | kmw | Shell Programming and Scripting | 1 | 08-04-2008 02:18 PM |
| Automate batchfile generation for sFTP | mpang_ | Shell Programming and Scripting | 0 | 04-26-2006 06:34 AM |
| Passing variables to sed | jfisch | Shell Programming and Scripting | 3 | 03-07-2005 07:25 AM |
| Passing awk Variables | gozer13 | Shell Programming and Scripting | 3 | 01-04-2005 04:32 PM |
| Passing Variables to Awk | Bab00shka | Shell Programming and Scripting | 2 | 10-05-2004 08:18 AM |