Hi forum,
So I am trying to determine the OS type with the following script:
#!/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
OStype1=`uname -s
equals
SunOs
I still get this system is not supported
# 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.