- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script Question
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
Forums
Discussions
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
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
02-19-2007 09:47 AM
02-19-2007 09:47 AM
Script Question
The set -x output on hosta gives the following output :
+ + date +%G-%m-%d
cdate=2007-02-19
+ + date +%H
chour=10
+ + date +%M
cmin=56
+ dated=2007-02-19_1056
+ uname -n
+ [ hosta = hostb ]
and comes back to the command prompt . The shell is ksh. Please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2007 09:57 AM
02-19-2007 09:57 AM
Re: Script Question
#!/usr/bin/ksh -x
if [ `uname -n` = hostb ]
then
echo "not on hosta"
else
echo "on hosta"
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2007 09:59 AM
02-19-2007 09:59 AM
Re: Script Question
+ [ hosta = hostb ]
+ echo on hosta
on hosta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2007 10:04 AM
02-19-2007 10:04 AM
Re: Script Question
~hope it helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2007 10:30 AM
02-19-2007 10:30 AM
Re: Script Question
~cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2007 08:48 PM
02-21-2007 08:48 PM
Re: Script Question
try:
if [[ $(uname -n) = hostb ]]
the improvment is using double [.
The $() is only good practice.
HTH,
Art