- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell 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
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
тАО11-18-2003 10:29 AM
тАО11-18-2003 10:29 AM
commandlist="$@" ;
status="noproblem"
for command in $commandlist
do
echo "Testing $command"
location=`which $command 2>/dev/null`
echo $location
if [ "x$location" = "x" ]; then
echo
echo "*** System command \"$command\" could not be found ! ***"
echo
status="error"
fi
done
if [ "$status" = "error" ]; then
return 1;
else
return 0;
fi
}
##
# Get the OS
##
OS=`uname`
##
# Check for the presence of system commands
##
if [ "$OS" = "SunOS" ]; then
isReachable "unzip sameer /usr/ucb/ps showrev patchadd pkginfo grep find ls uname cat rm chmod ln bc hostname df
sed awk head cpio cut dc wc expr nawk uniq jar"
fi
result=$?
if [ "$result" = "1" ]; then
echo "The above listed missing command(s) are necessary.Please make sure that these commands are in the environment path."
echo " Exiting..."
On Solaris the ├в which├в command writes to standard output instead of standard error and therefore isReachable returns a 0 even when the command is not found.
Can anybody please help me solve this problem?
Thanks in adv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2003 11:06 AM
тАО11-18-2003 11:06 AM
Re: shell script question??
Could you repost the question? Last post got some garbage in it.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2003 03:15 PM
тАО11-18-2003 03:15 PM
Re: shell script question??
if [ "$Location" = "File not found." ]; then
return 1;
else
return 0;
fi
Does
whereis -b
give you a different output?
Also my manual says you need to run this in csh so I would expect you might want to add
#!/bin/csh
as the first line.
Ron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2003 03:55 PM
тАО11-18-2003 03:55 PM
SolutionI think you need to check for the return code returned by isReachable function ,inside the if [ "$OS = "SunOS];
So, your script looks like,
if [ "$OS" = "SunOS" ]; then
isReachable "unzip sameer /usr/ucb/ps showrev patchadd pkginfo grep find ls uname cat rm chmod ln bc hostname df
sed awk head cpio cut dc wc expr nawk uniq jar"
result=$?
if [ "$result" = "1" ]; then
echo "The above listed missing command(s) are necessary.Please make sure that these commands are in the environment path."
echo " Exiting..."
fi
fi
-Madhu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2003 03:49 AM
тАО11-19-2003 03:49 AM
Re: shell script question??
make these adjustments and it should run:
which $command > /tmp/check.$$ 2>&1
location=`grep -v "no ${command} in" /tmp/check.$$`
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2003 02:59 AM
тАО11-26-2003 02:59 AM
Re: shell script question??
if the problem is solved, could you spare some points from the endless supply of points, HP has, for those, who could help you? ;-)
greetings,
Michael