- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: trouble with "||" operand
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
тАО04-17-2008 04:28 AM
тАО04-17-2008 04:28 AM
Re: trouble with "||" operand
Chris is obviously using a real shell and not the scummy C shell.
>Aashique: your pattern hdisk[0-9]* will not work in if condition.
Why not? Pattern matching will work in [[ ]].
- Tags:
- scummy C shell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2008 04:35 AM
тАО04-17-2008 04:35 AM
Re: trouble with "||" operand
I check this way and its running.
$ more test
ANS=vpath02
a=`echo $ANS|awk '/hdisk[0-9]/ {print $0}'`
b=`echo $ANS|awk '/vpath[0-9]/ {print $0}'`
if [ $a ] || [ $b ]
then
echo " YES"
else
echo "NO"
fi
$ ./test
YES
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2008 04:39 AM
тАО04-17-2008 04:39 AM
Re: trouble with "||" operand
Ok thanks all,
I'll give take a look at these suggestions and let you know ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2008 04:48 AM
тАО04-17-2008 04:48 AM
Re: trouble with "||" operand
#!/bin/ksh
print "Please enter a hdisk or vpath you would like to check and potentially remove: \c"
while true
do
read ANS
if [[ $ANS = hdisk[0-9]* || $ANS = vpath[0-9]* ]] ; then
break
print "incorrect selection please enter a valid hdisk or vpath: \c"
else
print "incorrect selection please enter a valid hdisk or vpath: \c"
fi
done
echo $ANS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2008 05:01 AM
тАО04-17-2008 05:01 AM
Re: trouble with "||" operand
have a look the following url:
http://www.injunea.demon.co.uk/pages/page205.htm
should look something like:
if [ $ANS != hdisk[0-9]* ] || [ $ANS != vpath[0-9]* ]
then
..
(unfortunately, i do not have any machine at hand to validate this right now!)
The [[ ]] are not properly stated.
hope this helps!
kind regards
yogeeraj
- Tags:
- Bourne
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2008 11:31 AM
тАО04-17-2008 11:31 AM
Re: trouble with "||" operand
http://www.injunea.demon.co.uk/pages/page205.htm
This appears to be Borne shell document, not ksh or posix.
http://docs.hp.com/en/B2355-60130/sh-posix.1.html
http://docs.hp.com/en/B2355-60130/ksh.1.html
- « Previous
-
- 1
- 2
- Next »