help with a script that will combine two separate scripts for solaris and aix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting help with a script that will combine two separate scripts for solaris and aix
# 1  
Old 10-04-2008
Network 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  
Old 10-04-2008
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  
Old 10-04-2008
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 01:29 PM.. Reason: no response..
# 4  
Old 10-04-2008
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  
Old 10-06-2008
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  
Old 10-06-2008
There doesn't seem to be anything here which we haven't answered already. Which parts are you having trouble with?
# 7  
Old 10-06-2008
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Separate X screens on x86 Solaris 11.3

Good morning, I` am trying to make a separate X screens on x86 machine Dell XE2 Intel i5 2.5Ghz . Video : Xeon E3-1200 v3/4 Gen Core Processor Integrated Graphics processor Using Solaris 11.3 Release: kernel SunOS 5.11 Gnome 2.30.2 So right now I have tried to change... (4 Replies)
Discussion started by: defs
4 Replies

2. UNIX for Beginners Questions & Answers

Combine awk scripts

Hi, Below command is working as expected, but would like to know how to club the two AWK scripts in the command into one echo -e "MMS000101S0203430A|20180412E|\nMMB0001INVESTMENT||107-86193-01-03|\nMMB0001FUND||107-86193-04-01|\nMMC9991 " | awk -F'|' -v OFS=, '/^MMC9991/{print r"|"s,t; next}... (3 Replies)
Discussion started by: JSKOBS
3 Replies

3. Shell Programming and Scripting

Sed script not working properly on Solaris (works fine on AIX)?

Hi, I have a problem with a SED script that works fine on AIX but does not work properly on a Solaris system. The ksh script executes the SED and puts the output in HTML in tables. But the layout of the output in HTML is not shown correctly(no tables, no color). Can anyone tell if there is... (7 Replies)
Discussion started by: Faith111
7 Replies

4. Shell Programming and Scripting

Combine the lines from separate text files

Hi All, I have three separate text files which has only one line and i want to combine these lines in one text file which will have three lines. cat file1.txt abc cat file2.txt 1265 6589 1367 cat file3.txt 0.98 0.36 0.5 So, I want to see these three lines in the... (9 Replies)
Discussion started by: senayasma
9 Replies

5. Shell Programming and Scripting

Script working in AIX, but giving error in SOLARIS

Hi, My script is working fine in AIX but throwing an error in SOLARIS system. Here is the error message that I am getting when calculating the elapsed time: /home/x772525/FindETA.sh: start_mins = *60 + : syntax error . ((start_mins = $(expr substr "$j" 1 2)*60 + $(expr substr "$j" 4... (6 Replies)
Discussion started by: ajayakunuri
6 Replies

6. Shell Programming and Scripting

how to combine two scripts into one

I need to combine two scripts, into one script. One is to delete something, the to recreate. Here is the scripts: BIN=/usr/lbin LINE='device for 0101a01: lpd://172.25.41.111:515' while read LINE do prt=`echo $LINE | awk '{print $3 }'| cut -c 1-7` echo $prt #drv=`echo $LINE | awk -F":"... (4 Replies)
Discussion started by: ggoliath
4 Replies

7. Shell Programming and Scripting

Separate sentences from two texts, combine them

I havet two books, one in Swedish, the other in English. Two text files. I want to combine them into one, with each sentence having it's translation next to it. ------------ Text file one. Example sentence in English. Example 2 sentence 2 in English 2. -------------- Text file two. ... (2 Replies)
Discussion started by: LaraMej
2 Replies

8. UNIX for Dummies Questions & Answers

how to separate numbers and words from a file using shell scripts

Hi, How to separate numbers and words(with full alphabets) in a particular file and store it in two different files. Please help me out for this.Using shell scripting. :confused::confused: (1 Reply)
Discussion started by: kamakshi s
1 Replies

9. Shell Programming and Scripting

i want to combine two awk scripts which is having same loop and filelist

hi, to all give me some idea below scripts file=`cat filelist` for filename in $file do awk '{ if ($0 ~ /system/ && flag == 0) { flag=1; print $0; } else if ($0 ~ /system/ && flag == 1) { printf("%s SYSLAY %s %s %s\n",$1,$3, $4, $5); } else print $0; }' $filename >... (6 Replies)
Discussion started by: LAKSHMI NARAYAN
6 Replies

10. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies
Login or Register to Ask a Question