Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Idea to make a function as microservice Post 303037164 by rbatte1 on Thursday 25th of July 2019 06:17:40 AM
Old 07-25-2019
I'm not sure on your question, but your code is a little confusing with all the quotes and the sub-process in $(...). I think that the decision for true && is based on the output of the echo -n -e "OS Archi..... statement rather thatn the result of the sub-process.

I think you are trying to make a decision based on the output of arch | grep .... so perhaps the following would be more suitable:-
Code:
[ "$(arch)" = "x86_64" ]  && myarch="64 Bit" || myarch="32 Bit"
echo "OS Architecture : ${myarch}" | tee -a "${FinalLogName}"

There will be other perhaps neater ways to do this, but this is more explicit to me; make the decision and set your message then have one output statement to show the whole thing (copied to the log)



Does that help, or have I missed the point entirely?




Kind regards,
Robin.

Last edited by rbatte1; 07-25-2019 at 07:18 AM.. Reason: Missed a closing quote and added braces round variable name
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Limitations of awk? Good idea? Bad idea?

Keeping in mind that I'm relatively comfortable with programming in general but very new to unix and korn/bourne shell scripts.. I'm using awk on a CSV file, and then performing calculations and operations on specific fields within specific records. The CSV file I'm working with has about 600... (2 Replies)
Discussion started by: yongho
2 Replies

2. Shell Programming and Scripting

How to make variables in script function local?

Is it possible to make function variables local? I mean for example, I have a script variable 'name' and in function I have declared variable 'name' I need to have script's 'name' have the same value as it was before calling the function with the same declaration. The way to preserve a... (5 Replies)
Discussion started by: alex_5161
5 Replies

3. Programming

How to make a function friend to both base and derived class

Hi, I have a base class and derived a class from the base class, i want to print & read the data for the object created for the derived class,so i have overloaded both the << and >> operators and also have done the foward declaration. Below is the code snippet, #include <iostream> class... (3 Replies)
Discussion started by: ennstate
3 Replies

4. Shell Programming and Scripting

An curious idea, how to make it by the powerful script?

I use a simple script to do some quantum calculations with gaussian package. the script as follows #!/bin/sh #put a gaussian input file into a new folder in the same name #and submit this new job for i in *.gjf do FN=$( echo $i | sed 's/.gjf//') mkdir $FN mv... (1 Reply)
Discussion started by: liuzhencc
1 Replies

5. UNIX for Dummies Questions & Answers

make - foreach function

I wrote the following Makefile: dirs := a b c d files := $(foreach dir,$(dirs),$(wildcard $(dir)/*)) .PHONY: all all: touch $(files) The first two lines are taken from GNU make tutorial, Section 8.5 The foreach Function. I would expect the recipe touch $(files) to be... (2 Replies)
Discussion started by: ybelenky
2 Replies

6. Shell Programming and Scripting

Is it possible make the shell read functions 1 by 1 and calling an other function?

Greetings, I m wondering if it's possible do do the following : I have a simple function called "FindMoveDelete" which does the following : FindMoveDelete() { find . -iname "$FILENAME*.ext" -exec mv {} "$PATH/$VAR" \; && find . -maxdepth 1 -type d -iname "$FILENAME*" -exec rm -rf {}... (6 Replies)
Discussion started by: Sekullos
6 Replies

7. Programming

Make sure strtok_r() function

Hello, I was trying to understand more on strtok_r() function with following code: #include <stdio.h> #include <stdlib.h> #include <string.h> /* *From http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=strtok_r A FreeBSD man pages * */ int main() { char string1; char *sep =... (8 Replies)
Discussion started by: yifangt
8 Replies

8. Shell Programming and Scripting

How to make nested function local?

Hi, If I declare a function inside another function, it overwrites any previously declared function with the same name. This is NOT what I want. Example: #!/bin/bash _test() { echo test; } _myf() { # I'm using the same name as the other function. _test() { echo local test; }... (8 Replies)
Discussion started by: chebarbudo
8 Replies

9. Shell Programming and Scripting

Function - Make your function return an exit status

Hi All, Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition. #Body function1() { if then echo "exist" else echo "not exist" } #if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
OCI_FIELD_TYPE(3)														 OCI_FIELD_TYPE(3)

oci_field_type - Returns a field's data type name

SYNOPSIS
mixed oci_field_type (resource $statement, mixed $field) DESCRIPTION
Returns a field's data type name. PARAMETERS
o $statement - A valid OCI statement identifier. o $field - Can be the field's index (1-based) or name. RETURN VALUES
Returns the field data type as a string, or FALSE on errors. EXAMPLES
Example #1 oci_field_type(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); $column_size = oci_field_size($stid, $i); echo "<tr>"; echo "<td>$column_name</td>"; echo "<td>$column_type</td>"; echo "<td>$column_size</td>"; echo "</tr> "; } echo "</table> "; // Outputs: // Name Type Length // NUMBER_COL NUMBER 22 // VARCHAR2_COL VARCHAR2 1 // CLOB_COL CLOB 4000 // DATE_COL DATE 7 oci_free_statement($stid); oci_close($conn); ?> NOTES
Note In PHP versions before 5.0.0 you must use ocicolumntype(3) instead. This name still can be used, it was left as alias of oci_field_type(3) for downwards compatability. This, however, is deprecated and not recommended. SEE ALSO
oci_num_fields(3), oci_field_name(3), oci_field_size(3). PHP Documentation Group OCI_FIELD_TYPE(3)
All times are GMT -4. The time now is 04:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy