- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell script to check if patch is installed or not
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-07-2003 10:14 AM
08-07-2003 10:14 AM
I need to write a script which checks if a particular patch is installed or not.
I have written something like
if grep $input swlist1.out > /dev/null 2>&1
then
echo "installed"
else
echo "not installed"
fi
The output of swlist command is stored in the file swlist1.out
I'm getting this error.
ERRNO=25
LINENO=2
MAILCHECK=600
OPTIND=1
PPID=26004
RANDOM=24630
SECONDS=0
TMOUT=0
Please enter the name of the application
perl
You entered perl
./hpscript2.ksh[7]: swlist: not found
software perl not installed
Please help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2003 10:20 AM
08-07-2003 10:20 AM
Re: shell script to check if patch is installed or not
swlist -l fileset -a state | grep PH
This will tell you if it's on the box....and if it's configured or not.
You could output to a file if you want....by just ending with > to-this.file
Just a simple thought,
Rita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2003 10:24 AM
08-07-2003 10:24 AM
Re: shell script to check if patch is installed or not
It should be (ignore line wraps):
if [ `grep $input swlist1.out > /dev/null 2>&1` -eq 0 ]; then
echo "installed"
else
echo "not installed"
fi
Of course Rita's suggestion is much easier.
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2003 10:41 AM
08-07-2003 10:41 AM
Re: shell script to check if patch is installed or not
Thanks for your reply.
swlist -l fileset -a state | grep PHCO_23083
This command gives if that patch is installed or not.
But what if I have to check if a particular software(application) is installed or not?
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2003 10:49 AM
08-07-2003 10:49 AM
Solutionswlist -l product | grep -i cde
You could generalize this as a shell script if you wanted too.
#!/bin/sh
if [ -z "$1" ]; then
echo "arg needed"
exit 1;
fi
swlist -l product | grep -i "$1"
Save this where you want, make it executable and then run. E.G.
/usr/local/sbin/myswchk.sh CDE
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2003 10:49 AM
08-07-2003 10:49 AM
Re: shell script to check if patch is installed or not
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2003 10:55 AM
08-07-2003 10:55 AM
Re: shell script to check if patch is installed or not
thanks a lot.Your script did work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2003 11:02 AM
08-07-2003 11:02 AM
Re: shell script to check if patch is installed or not
BTW, my C coding slipped in by accident. The exit statement should not end in a semi-colin.
exit 1;
Should just be
exit 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2003 11:11 AM
08-07-2003 11:11 AM
Re: shell script to check if patch is installed or not
But thanks for reminding.