The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to separate numbers and words from a file using shell scripts kamakshi s UNIX for Dummies Questions & Answers 1 06-26-2008 09:02 AM
i want to combine two awk scripts which is having same loop and filelist LAKSHMI NARAYAN Shell Programming and Scripting 6 06-19-2007 05:02 PM
Solaris login scripts citrowske SUN Solaris 0 02-08-2007 04:11 PM
scripts no longer running (solaris 8) smcadoo UNIX for Advanced & Expert Users 3 01-25-2006 01:02 PM
kill scripts under Solaris 98_1LE UNIX for Dummies Questions & Answers 1 04-05-2002 05:15 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-04-2008
solaix14 solaix14 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 48
Angry help with a script that will combine two separate scripts for solaris and aix

Hello experts,
I have separate scripts (KSH) each for Solaris and AIX to install core applications (e.g. BigBrother). I also have a script called Installer that gives a menu list to select a particular application to install from a bunch of applications.
Now I am trying to combine separate scripts into a single one so that:

1) when I first run "Installer" script, it will find out whether it is a Solaris or an AIX box
2) run the solaris part of script if it is solaris box and AIX part if it is IBM box from the merged script. (something like jump to AIX script once the installer script finds IBM box or vice versa)


please help me on this
  #2 (permalink)  
Old 10-04-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
Assume your two scripts are called solaris.sh and aix.sh
Create a wrapper script
Code:
uname | grep -qi aix 
if [ $? -eq 0 ]
      aix.sh
else
      solaris.sh
fi
This assumes you have a POSIX-compliant uname on both systems.
  #3 (permalink)  
Old 10-04-2008
solaix14 solaix14 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 48
Hello experts,
please help me on this.
This is the scenario:
I have applications like BigBrother,PowerKeeper/PowerBroker etc.. which I have to install during server build for both AIX and Solaris. I already have separate installation scripts for both OS for all applications. Now, I want to merge these separate script (e.g. bigbrotheraix.ksh and bigbrothersolaris.ksh into a single bigbrotherunix.ksh)

From one of my script "installer.ksh", (menu to select the desired application from so many other applications). your above wrapper works fine to select either solaris or aix using 'uname'. I will put this wrapper at the top of installer.ksh script to select OS and print message:: print "you have selected $OS box to install your application. Please select from the menu below to install $OS compatable application"
now when an item is selected from the menu,I should be able to go to the single script containing both solaris and AIX scripts (e.g. bigbrotherunix.ksh) and select solaris part of the script if that turns out to be a solaris box.

thanks for your attention.

Last edited by solaix14; 10-05-2008 at 12:29 PM.. Reason: no response..
  #4 (permalink)  
Old 10-04-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
Something like this then.

Code:
# early on in the script
uname=$(uname)

# now whenever you need to branch
case $uname in
  AIX)  do aix stuff
        do some more aix stuff;;
  Solaris)
        do solaris stuff;;
esac
You will probably want to experiment a bit with a suitable uname string. I'm guessing it might be uppercase AIX and proper-case Solaris but I don't have easy access to either system to check this.
  #5 (permalink)  
Old 10-06-2008
solaix14 solaix14 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 48
help using case-statement for Korn shell

Hello experts,
1) I have two scripts (one for Solaris and one for AIX), now I want to put these two scripts into a single one.
2) Now I want to run this script (combined) from another script to:
a) select if it is a solaris box or AIX
b) run the solaris part of script from the combined script if the box
comes out to be solaris or vice versa using case-statement.

thanks in advance.
  #6 (permalink)  
Old 10-06-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
There doesn't seem to be anything here which we haven't answered already. Which parts are you having trouble with?
  #7 (permalink)  
Old 10-06-2008
solaix14 solaix14 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 48
era,
thanks for responding back.
can you please help me with this one in particular:
Code:
 
OStype='uname -s'
case $OStype in
SUN) commands;;
 
AIX) commands;;
 
esac
Will you please be kind enough to fill up the commands field that
will go to the AIX part of script once OStype=AIX and vice-versa.
I have not changed any thing in the original script but appended AIX script at the bottom of Solaris script.

( I am not so much familiar with scripting,,your help will be really appreciated)

thanks in advance.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:10 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0