- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to get output of an ftp command into a variabl...
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
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
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
тАО01-24-2011 12:37 AM
тАО01-24-2011 12:37 AM
how to get output of an ftp command into a variable
message1=`ftp -i -n -v ${server} >> $LOG <
ascii
umask 022
cd $FROM_DIRECTORY
lcd $TO_DIRECTORY/$dt_stamp_yday
ls
mget *.txt
bye
EOF`
It is running successfully. But now I want to download the files based on time.
JRF (Forum member) suggested modtime command to get the modified time of remote file.
Now my question is I want to take output of modtime command to a variable so that I can refer that variable in the script.
Please tell me how can I do that.
- Tags:
- variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2011 03:25 AM
тАО01-24-2011 03:25 AM
Re: how to get output of an ftp command into a variable
You can get the output of ls into a file:
ls [remote-directory] [local-file]
modtime doesn't seem to be able to redirect the output. With your above message1=$(ftp ...) you can capture that output and the parse it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2011 05:28 AM - last edited on тАО08-08-2011 12:25 PM by Kevin_Paul
тАО01-24-2011 05:28 AM - last edited on тАО08-08-2011 12:25 PM by Kevin_Paul
Re: how to get output of an ftp command into a variable
Hi:
In a reply I made in your previous thread, I wrote, "You could use something like 'dir' to collect a listing (with dates) of the files in a directory and then parse that list, though."
http://h30499.www3.hp.com/t5/System-Administration/Download-files-to-local-server-using-ftp-script-based-on-date/m-p/4735316#M386809
Since you are redirecting your FTP session output to a file (${LOG}) you can parse ('grep', 'awk', 'perl') that after the FTP session ends and thus deliver the information you want to the encapsulating script. I would think that this should include the response from 'modtime'. If so, you will need to parse it out of the ${LOG} output.
I don't see the value of using 'message1' to collect information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-24-2011 05:53 AM
тАО01-24-2011 05:53 AM
Re: how to get output of an ftp command into a variable
I will do the parsing.
Actually I am searching for a way to directly get the output of ftp command like dir,pwd into a variable.
It seems there is no direct way other than parsing.