I have changed it to include quotations around the variable in the comparison and use an integer operator, per your suggestion, RudiC and still not working for me:
Code:
Output
Last edited by vgersh99; 04-15-2016 at 11:35 AM..
Reason: fixing code tags - code, not icode
Hi ...
I am trying to calculate the time needed for a command to execute..
but the resulting value is getting as string..
so i am not able to use "expr " command..
please help me to convert the value to integer so that i can proceed with my script..
Regards
esham (1 Reply)
Hi all,
I'm trying to convert a decimal number into an integer number; I'm doing this:
n=`echo |awk '{ print "'"$mem"'"*10}'`
where the variable mem is equal to 3.7
I'd like to obtain 37, but the expression above gives me 30.
Help please!!!!
thx a lot (4 Replies)
Hi,
I am passing a variable to a unix function.
However when I try to assign the value to another variable like
typeset -i I_CACHE_VAL=$2
Is this because of String to Integer conversion?
I get an error.
Please help me with thsi.
Thanks (2 Replies)
Hi everyone,
I would like to know how to convert an integer to a string. for instance if i=1 i would like to creat a variable called constant1. i want to do this in a for loop so for each value of i, i create a new variable such as constant2, constant3,... and so on.
for i in 1 2 3
do ... (1 Reply)
The shell mentioned below will show a warning if the page takes more than 6 seconds to load.
The problem is that myduration variable is not an integer. How do I convert it to integer?
myduration=$(curl http://192.168.50.1/mantisbt/view.php?id=1 -w %{time_total}) > /dev/null ; ] && echo... (3 Replies)
okay so i run an openssl command to get the date of an expired script. Doing so gives me this:
enddate=Jun 26 23:59:59 2012 GMT
Then i cut everything out and just leave the month which is "Jun"
Now the next part of my script is to tell the user if the the certificate is expired or not... (6 Replies)
Dear community,
i got a problem to get "date +%j" as the right value.
Today is the 10th day of the year.
#./script.sh 2
#!/bin/bash/
Var1=$(date +%j)
Var2=$1
let result=$Var1+$Var2
echo $Var1 plus $Var2 equals $result
The output of the script is:
010 plus 2 equals 10... (9 Replies)
Hi guys,
I'm new here. I have a problem at work. One of our scripts was eventually having a bug and only detected recently. Here's the issue and background:
Bash Script which calls AWK script
Awk script returns a string as per below (example):var1='00000-123'So, when we convert it, the... (18 Replies)
Hello,
How can we convert date like format 20181004171050 in seconds ?
I can able to convert till date but failing for HHMMSS.
date -d "20181004" "+%s" output as 1538596800 .
But when i add hhmmss it is failing date -d "20181004172000" "+%s" result Invalid date
Kindly guide.
Regards (16 Replies)
Discussion started by: sadique.manzar
16 Replies
LEARN ABOUT OPENSOLARIS
system
system(3C) Standard C Library Functions system(3C)NAME
system - issue a shell command
SYNOPSIS
#include <stdlib.h>
int system(const char *string);
DESCRIPTION
The system() function causes string to be given to the shell as input, as if string had been typed as a command at a terminal. The invoker
waits until the shell has completed, then returns the exit status of the shell in the format specified by waitpid(3C).
If string is a null pointer, system() checks if the shell exists and is executable. If the shell is available, system() returns a non-zero
value; otherwise, it returns 0. The standard to which the caller conforms determines which shell is used. See standards(5).
The system() function sets the SIGINT and SIGQUIT signals to be ignored, and blocks the SIGCHLD signal for the calling thread, while wait-
ing for the command to terminate. The system() function does not affect the termination status of any child of the calling processes other
than the process it creates.
The termination status of the process created by the system() function is not affected by the actions of other threads in the calling
process (it is invisible to wait(3C)) or by the disposition of the SIGCHLD signal in the calling process, even if it is set to be ignored.
No SIGCHLD signal is sent to the process containing the calling thread when the command terminates.
RETURN VALUES
The system() function executes posix_spawn(3C) to create a child process running the shell that in turn executes the commands in string. If
posix_spawn() fails, system() returns -1 and sets errno to indicate the error; otherwise the exit status of the shell is returned.
ERRORS
The system() function may set errno values as described by fork(2), in particular:
EAGAIN A resource control or limit on the total number of processes, tasks or LWPs under execution by a single user, task, project,
or zone has been exceeded, or the total amount of system memory available is temporarily insufficient to duplicate this
process.
ENOMEM There is not enough swap space.
EPERM The {PRIV_PROC_FORK} privilege is not asserted in the effective set of the calling process.
USAGE
The system() function manipulates the signal handlers for SIGINT and SIGQUIT. It is therefore not safe to call system() in a multithreaded
process, since some other thread that manipulates these signal handlers and a thread that concurrently calls system() can interfere with
each other in a destructive manner. If, however, no such other thread is active, system() can safely be called concurrently from multiple
threads. See popen(3C) for an alternative to system() that is thread-safe.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Unsafe |
+-----------------------------+-----------------------------+
SEE ALSO ksh(1), sh(1), popen(3C), posix_spawn(3C), wait(3C), waitpid(3C), attributes(5), standards(5)SunOS 5.11 14 Dec 2006 system(3C)