- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Dynamically Generate New Files with new o/p
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
Forums
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
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
06-14-2007 03:28 AM
06-14-2007 03:28 AM
do
j=$serv_cnt
echo "===[ Directory List for Server: $serv_cnt ]==="
ssh $serv_cnt "find /mfgdata/ -type d -exec ls -ld {} \; 2>/dev/null "
done >> $j.mfgdata-ux-dir.ls
How can I dynamically generated output file with differnt names??? Here $j does not seem to taking it correctly.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2007 03:39 AM
06-14-2007 03:39 AM
Solution#!/usr/bin/sh
typeset serv_cnt=""
cat /home/mfgeb/pp/serv.txt | while read serv_cnt
do
echo "===[ Directory List for Server: $serv_cnt ]==="
ssh $serv_cnt "find /mfgdata/ -type d -exec ls -ld {} \; 2>/dev/null " >> "${serv_cnt}.mfgdata-ux-dir.ls"
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2007 03:40 AM
06-14-2007 03:40 AM
Re: Dynamically Generate New Files with new o/p
do
OF=${serv_cnt}.mfgdata-ux-dir.ls
echo "===[ Directory List for Server: $serv_cnt ]===" > ${OF}
ssh ${serv_cnt} "find /mfgdata -type d -exec ls -ld {} \; 2>/dev/null" >> ${OF}
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2007 03:44 AM
06-14-2007 03:44 AM
Re: Dynamically Generate New Files with new o/p
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2007 04:15 AM
06-14-2007 04:15 AM
Re: Dynamically Generate New Files with new o/p
I don't know what the rest of your loop is doing, but having started the ssh without closing its input/output, it be be cannibalizing the 'for .. in'. Execute always 'ssh -n' in that cases.
So try (more modification included):
while read j
do
print "===[ Directory List for Server: $j ]==="
ssh -n $j 'find /mfgdata -type d 2>/dev/null |
xargs ls -ld' >>$j.mfgdata-ux-dir.ls
...
done
mfG Peter