Sponsored Content
Top Forums UNIX for Advanced & Expert Users A script to detect system type Post 303011823 by rbatte1 on Wednesday 24th of January 2018 05:02:05 AM
Old 01-24-2018
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.



I hope that this helps,
Robin
This User Gave Thanks to rbatte1 For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Not able to detect nr of cpu in Solaris System

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)
Discussion started by: pbonato
1 Replies

2. HP-UX

more than one fs type on the same file system

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)
Discussion started by: livemyway
1 Replies

3. Shell Programming and Scripting

Using 'stat' to determine file system type (with Zenity)

edited and removed (0 Replies)
Discussion started by: mdpalow
0 Replies

4. UNIX for Dummies Questions & Answers

How do I know what type of shells are available in my Unix system?

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)
Discussion started by: shuhang2
7 Replies

5. Red Hat

File system type

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)
Discussion started by: William1482
4 Replies

6. UNIX for Advanced & Expert Users

how to findout the file system type?

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)
Discussion started by: psiva_arul
1 Replies

7. HP-UX

How to determine the fie system type?

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)
Discussion started by: notreallyhere
3 Replies

8. AIX

AIX 5.2 installation on 'IBM system p5 type 9110-51A'

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)
Discussion started by: nd007
4 Replies

9. Shell Programming and Scripting

Detect Operating System

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)
Discussion started by: mohtashims
9 Replies
SQLSRV_HAS_ROWS(3)														SQLSRV_HAS_ROWS(3)

sqlsrv_has_rows - Indicates whether the specified statement has rows

SYNOPSIS
bool sqlsrv_has_rows (resource $stmt) DESCRIPTION
Indicates whether the specified statement has rows. PARAMETERS
o $stmt - A statement resource returned by sqlsrv_query(3) or sqlsrv_execute(3). RETURN VALUES
Returns TRUE if the specified statement has rows and FALSE if the statement does not have rows or if an error occurred. EXAMPLES
Example #1 sqlsrv_has_rows(3) example <?php $server = "serverNamesqlexpress"; $connectionInfo = array( "Database"=>"dbName", "UID"=>"username", "PWD"=>"password" ) $conn = sqlsrv_connect( $server, $connectionInfo ); $stmt = sqlsrv_query( $conn, "SELECT * FROM Table_1"); if ($stmt) { $rows = sqlsrv_has_rows( $stmt ); if ($rows === true) echo "There are rows. <br />"; else echo "There are no rows. <br />"; } ?> SEE ALSO
sqlsrv_num_rows(3), sqlsrv_query(3). PHP Documentation Group SQLSRV_HAS_ROWS(3)
All times are GMT -4. The time now is 04:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy