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
OCI_FIELD_NAME(3)														 OCI_FIELD_NAME(3)

oci_field_name - Returns the name of a field from the statement

SYNOPSIS
string oci_field_name (resource $statement, mixed $field) DESCRIPTION
Returns the name of the $field. PARAMETERS
o $statement - A valid OCI statement identifier. o $field - Can be the field's index (1-based) or name. RETURN VALUES
Returns the name as a string, or FALSE on errors. EXAMPLES
Example #1 oci_field_name(3) example <?php // Create the table with: // CREATE TABLE mytab (number_col NUMBER, varchar2_col varchar2(1), // clob_col CLOB, date_col DATE); $conn = oci_connect("hr", "hrpwd", "localhost/XE"); if (!$conn) { $m = oci_error(); trigger_error(htmlentities($m['message']), E_USER_ERROR); } $stid = oci_parse($conn, "SELECT * FROM mytab"); oci_execute($stid, OCI_DESCRIBE_ONLY); // Use OCI_DESCRIBE_ONLY if not fetching rows echo "<table border="1"> "; echo "<tr>"; echo "<th>Name</th>"; echo "<th>Type</th>"; echo "<th>Length</th>"; echo "</tr> "; $ncols = oci_num_fields($stid); for ($i = 1; $i <= $ncols; $i++) { $column_name = oci_field_name($stid, $i); $column_type = oci_field_type($stid, $i); echo "<tr>"; echo "<td>$column_name</td>"; echo "<td>$column_type</td>"; echo "</tr> "; } echo "</table> "; // Outputs: // Name Type // NUMBER_COL NUMBER // VARCHAR2_COL VARCHAR2 // CLOB_COL CLOB // DATE_COL DATE oci_free_statement($stid); oci_close($conn); ?> NOTES
Note In PHP versions before 5.0.0 you must use ocicolumnname(3) instead. This name still can be used, it was left as alias of oci_field_name(3) for downwards compatability. This, however, is deprecated and not recommended. SEE ALSO
oci_num_fields(3), oci_field_type(3), oci_field_size(3). PHP Documentation Group OCI_FIELD_NAME(3)
All times are GMT -4. The time now is 06:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy