- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- help with a unix script to transfer files from win...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2014 04:36 AM
03-27-2014 04:36 AM
help with a unix script to transfer files from windows to hp-ux
I have the following script to transfer a file, but ist not doing what he supposed to do it:
#! /usr/bin/ksh HOST=my_windows_system USER=ftp_ndo PASSWD=123abcD exec 4>&1 ftp -nv >&4 2>&4 |& print -p open $HOST print -p user $USER $PASSWD print -p cd Ordens print -p binary print -p get Shipment.csv print -p bye wait exit 0
And when I run it, I have the following output:
./get_dealer_voucher.ksh Connected to my_windows_system 220-FileZilla Server version 0.9.39 beta 220-written by Tim Kosse (Tim.Kosse@gmx.de) 220 Please visit http://sourceforge.net/projects/filezilla/ Remote system type is UNIX. 331 Password required for ftp_hm 530 Login or password incorrect! Login failed. 530 Please log in with USER and PASS first. 530 Please log in with USER and PASS first. 530 Please log in with USER and PASS first. 530 Please log in with USER and PASS first. 221 Goodbye
So I am not getting the file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2014 07:25 AM
03-27-2014 07:25 AM
Re: help with a unix script to transfer files from windows to hp-ux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2014 08:02 AM
03-27-2014 08:02 AM
Re: help with a unix script to transfer files from windows to hp-ux
I have corrected my mistake, but still:
$ vi get_dealer_voucher.ksh "get_dealer_voucher.ksh" 18 lines, 230 characters #! /usr/bin/ksh HOST=10.100.48.41 USER=ftp_hm PASSWD=P@$$w0rd exec 4>&1 ftp -nv >&4 2>&4 |& print -p open $HOST print -p user $USER $PASSWD print -p cd Ordens print -p binary print -p get Shipment.csv print -p bye wait exit 0
and the result:
./get_dealer_voucher.ksh Connected to 10.100.48.41. 220-FileZilla Server version 0.9.39 beta 220-written by Tim Kosse (Tim.Kosse@gmx.de) 220 Please visit http://sourceforge.net/projects/filezilla/ Remote system type is UNIX. 331 Password required for ftp_hm 530 Login or password incorrect! Login failed. 530 Please log in with USER and PASS first. 530 Please log in with USER and PASS first. 530 Please log in with USER and PASS first. 530 Please log in with USER and PASS first. 221 Goodbye
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2014 10:49 AM
03-27-2014 10:49 AM
Re: help with a unix script to transfer files from windows to hp-ux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2014 11:25 AM
03-27-2014 11:25 AM
Re: help with a unix script to transfer files from windows to HP-UX
>exec 4>&1
Why are you using something so complex? Just use a simple here doc:
ftp -nv $HOST <<EOF
user $USER $PASSWD
cd Ordens
binary
get Shipment.csv
bye
EOF
You still may have to pay attention to Steven's statement about quoting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2014 11:23 AM
03-30-2014 11:23 AM
Re: help with a unix script to transfer files from windows to HP-UX
Regarding quoting, you should know that "$$" means "insert the PID of the current shell session here".
So, if your script is running with PID 16404 when it gets to this line:
PASSWD=P@$$w0rd
it replaces "$$" with "16404", and your script will end up sending the password as "P@16404w0rd".
The solution is to put single quotes around the password string:
PASSWD='P@$$w0rd'
Double quotes won't work here: within double quotes, the shell will still attempt to replace variable names (=anything beginning with the $ character) with their respective values. Within single quotes, this won't happen.
The only character that has a special meaning within a single-quoted string is the single-quote character itself.
If your password actually includes a single-quote character, it can be represented by closing the single-quote, typing \' (backslash and single-quote), then opening another single-quoted string.
Example:
$ echo 'R3@lly\H@rd'\''P@$$w0rd' R3@lly\H@rd'P@$$w0rd
- Tags:
- quoting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2014 12:01 PM
03-30-2014 12:01 PM
Re: help with a unix script to transfer files from windows to HP-UX
>The only character that has a special meaning within a single-quoted string is the single-quote.
Not really "within" but "end" of the string.
>closing the single-quote, typing \' (backslash and single-quote)
Rather than stuttering quoting it's probably easier to use "\" within ("):
echo "R3@lly\\H@rd'P@\$\$w0rd"