So I am trying to determine the OS type with the following script:
Code:
#!/usr/bin/sh
OStype1=`uname -s`
Sunos1=SunOs
if [ "${OStype1}" = "Linux" ]
then
echo "This system is Linux"
exit 0
elif [ "${OStype1}" = "SunOs" ]
then
echo "This system is SunOs"
exit 0
elif [ "${OStype1}" = "HP-UX" ]
then
echo "This system is HP-UX"
exit 0
else
echo "This system is not supported"
exit 0
fi
So far it is working ok for linux and hp-ux system types, but with no luck on Solaris.
Although the
Code:
OStype1=`uname -s
equals
Code:
SunOs
I still get this system is not supported
Code:
# sh -x test.sh
+ uname -s
OStype1=SunOS
Sunos1=SunOs
+ [ SunOS = Linux ]
+ [ SunOS = SunOs ]
+ [ SunOS = HP-UX ]
+ echo This system is not supported
This system is not supported
+ exit 0
Can you help me out by suggesting how to fix the script in order to work for Solaris?
---------- Post updated at 04:45 AM ---------- Previous update was at 04:29 AM ----------
Sorry to bother you, I have typed SunOs instead of SunOS. It is ok now.
Might I also suggest a case statement rather that if...then...elif...then...elif...then...elif...then...fi
Perhaps this might be neater:-
Code:
case "${OSType1}" in
Linux) echo "This is Linux" ;;
SunOS) echo "This is Solaris" ;;
HP-UX) echo "This is HPUX" ;;
AIX) echo "This is the best." ;;
*) echo "This in unknown" ;;
esac
You can add more statements between each choice. The last statement to be run for each choice ends in ;; and esac ends the whole case statement.
Hi,
I need a script that needs to detect the Operating System and based upon wheter it is Linux, Solaris x86, Sparc, Itanium etc it should populate "ps" command with detailed output accordingly
for example:
ps -xef | grep java -> Itaniumps -auxwww | greap java -> Solaris (9 Replies)
Hi All,
I am new to AIX, not completly though.. I got a task to install AIX 5.2 on 'IBM system p5 type 9110-51A' server. I tried few things, but i am not able to get to the console of this server to proceed with the installation. I have installed AIX 6.1 earlier, but those servers can be plugged... (4 Replies)
Good day
I need create new mount points on a server. I'm not very familiar with HP-UX and was given steps on how to go about doing the mounting, etc.
Before I start though, I need to determine which file system type is currently being used. This will determine whether i need to extend the... (3 Replies)
Hi all,
How to findout the file sytem type which is NFS and which is Local?
Suppose i have 5 different folders my in Root directory. dir 4 and 5 are mounted on different file system and dir 1,2 and 3 are mounted on different fild system
Now i wanted know which file sytem is Local and which... (1 Reply)
Hi all,
How to find out what type of file system is my system configured for Red hat linux 8.0 ? whether it is NTFS or FAT32 or FAT16...
Can somebody help me on this?
Regards,
William (4 Replies)
How do I know what type of shells are available in my Unix system? Are there a single command or environment variable that can let me find that out?
Best regards,
John Chan (7 Replies)
hi
is it possible to have more than one file system types on the same file system.
if yes then how do we do it,
can veritas be used to achieve this (1 Reply)
Hello,
how can I detect the nr of cpu of my SUN E250 Solaris server? I have tryed with top but I was not able to find the information.
Thanks. (1 Reply)