- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- scripts error help
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
08-19-2001 11:01 PM
08-19-2001 11:01 PM
============================================
if $server eq "Started" then
echo "OK"
fi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2001 11:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2001 11:57 PM
08-19-2001 11:57 PM
Re: scripts error help
For string comparision you have to use quotes
if [ "$A" = "String" ];then
.
.
.
fi
...BPK...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2001 12:02 AM
08-20-2001 12:02 AM
Re: scripts error help
this is depending in which case you wan?t to use this script. for your simple case
if ["$server" = "started"]
then
echo ok
else
if ["$server" = ""]
echo nostatus
else
NO
fi
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2001 12:03 AM
08-20-2001 12:03 AM
Re: scripts error help
=0 --> OK (true)
<>0 --> FAIL (false)
Long time ago, the "test" command was used (see manual pages of test command).
if test $X -eq $Y ???
Now shells have got buit-in this command and uses alternate notation (the braket).
if [ $X = $Y ] ???
If you use double brackets the notation for some operators as AND, OR, ... has changed. See the following example:
if [ $X = 3 -a $Y = 2 ] ???
if [[ $X = 3 && $Y = 2 ]] ???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2001 01:47 AM
08-20-2001 01:47 AM
Re: scripts error help
-eq is Numerical equals e.g
if [ $var -eq 0 ]
then
.....
= is equivalent ASCII e.g.
if [ $var = hello ]
then
there is a similar distinction between
-lt & <
-gt & >
-le & <=
-ge & >=
but obviously seeing if a character is greater than an ASCII character is less intuative
You can get all the above from man ksh...
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2001 09:42 AM
08-20-2001 09:42 AM