- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- export variable
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
11-03-2003 09:17 PM
11-03-2003 09:17 PM
I have some bad problem with a script who should check all my users whose password is the same as the login - name. I tried it with an ftp - server.
Here it is:
for USER in `/usr/bin/ypcat passwd | awk
-F: '{print $1}' `
do
{
ftp -n << !
open SERVER
user $USER $USER
!
}
done
The problem is, variable $USER isn´t seen in
the ftp - call.
thank
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 09:26 PM
11-03-2003 09:26 PM
Re: export variable
after
for USER in `/usr/bin/ypcat passwd | awk
-F: '{print $1}' `
do
export user=$USER
and then use $user in ftp script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 09:44 PM
11-03-2003 09:44 PM
Re: export variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 10:31 PM
11-03-2003 10:31 PM
Re: export variable
Inside a here document (ie the bit between the "<<" and the "!", some characters, including $, need escaping.
Try changing "$USER" to "\$USER" both times.
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 11:28 PM
11-03-2003 11:28 PM
Re: export variable
Here's the earlier thread, doesn't look like it was resolved though....
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=242133
- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2003 12:26 AM
11-04-2003 12:26 AM
Re: export variable
thank you very much for your reply!
I´d tried the export - dialog before I called the forum, but there it doesn´t work, and now it does?!?
How can I get the Returncode ( $? )??
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2003 12:30 AM
11-04-2003 12:30 AM
Re: export variable
if you run your script like this:
# sh -x
what error messages do you get?
Btw: does the first line: from "for USER" until and including the second backqoute appear on a single line?
regards,
John K.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2003 12:31 AM
11-04-2003 12:31 AM
Solutionfirst: dont use the variable name USER - it is used internally on some systems.
second: Send the ftp-command via a pipe
(KSH-like):
for usr in $(ypcat passwd | awk -F: '{print $1}')
do
ftpout=$(print "open SERVER\nuser $usr $usr" | ftp -n 2>&1)
[ -z "$ftpout" ] && print $usr
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2003 02:39 AM
11-04-2003 02:39 AM
Re: export variable
thank you all for help.
Greethings,
Alex