Sponsored Content
Top Forums Shell Programming and Scripting How to capture system() function output in variable Post 302911320 by bharat1211 on Thursday 31st of July 2014 07:00:58 AM
Old 07-31-2014
Thanks
Yeah I agree with you...but I want to know how to store result of system() function..........
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[csh] How to capture output from a command and pass it on to a variable?

Hi there! I'm trying to write a script that will capture output from a command and assign it to a variable. Let's say, for example, I'd like to catch from inside the script whatever the following command outputs: ls *.aaa and put it into a variable "listoffiles". What I tried was: set... (3 Replies)
Discussion started by: machinogodzilla
3 Replies

2. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies

3. Shell Programming and Scripting

how to capture oracle function returning 2 values in unix

i have an oracle function which returns two values, one is the error message if the function encounters anything and another one which returns a number i need to capture both and pass it on to unix shell script how to do it (2 Replies)
Discussion started by: trichyselva
2 Replies

4. Programming

[C language] system function print output when not expected.

Hi, I am new to C and have a little problem. I am not planning to be a C expert, but this would be nice to understand. The problem is that a 'system' call prints it output to stdout, when I do not expect this. This is the program: trial.c #include <ctype.h> #include <unistd.h>... (5 Replies)
Discussion started by: ejdv
5 Replies

5. Shell Programming and Scripting

unix capture oracle function error

Hi, I want to execute an oracle function from unix script so for that I created a sample oracle function as below: create or replace function test_fn(test_date out varchar2) RETURN varchar2 IS BEGIN select to_char(sysdate,'DD-MON-YY') into test_date from dual; return test_date;... (5 Replies)
Discussion started by: dips_ag
5 Replies

6. Programming

capture the output of printf into another variable

Hi , I wonder if in java I can pipe the below output of the printf into a variable: System.out.printf(" This is a test %s\n", myVariable); I want to keep the output of the printf command to create my history array. Thanks. (2 Replies)
Discussion started by: arizah
2 Replies

7. Shell Programming and Scripting

System Output in to an Array or variable

hey guys in only new to scripting as such, but i have a problem. i want to take the output of a search i do in the command line to then be in a variable but only a certain part of the output. this this what im doing: -bash-2.05b$ ldapsearch -x '(dn:=dc)' dc|grep dc= # base... (1 Reply)
Discussion started by: jmorey
1 Replies

8. UNIX for Dummies Questions & Answers

Capture Multiple Lines Into Variable As Of Standard Output

Hello All, I have the below script and output. cat test.sh #!/bin/bash -x logit() { echo " - ${*}" > ${LOG_FILE} } LOG_FILE=/home/infrmtca/bin/findtest.log VAR=`find . -type f -name "*sql"` logit $VAR Output: cat /home/infrmtca/bin/findtest.log -... (9 Replies)
Discussion started by: Ariean
9 Replies

9. Homework & Coursework Questions

How to Dynamically Pass Parameter to plsql Function & Capture its Output Value in a Shell Variable?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 2. Relevant commands, code, scripts, algorithms: #! /bin/ksh v="ORG_ID" ... (2 Replies)
Discussion started by: sujitdas2104
2 Replies

10. Red Hat

Unable to capture value from function

Hi Experts, Am writing a code which need to check for the previous day date and pickup the file as per the previous day date. Problem: Why variable "YDATE" is empty ? O/S: RHEL 5.6 Shell: BASH Desired O/P: ls -lrt /opt/test/user/atsuser.NHU/out/demon.08272017 When I checked the... (3 Replies)
Discussion started by: pradeep84in
3 Replies
explain_nice(3) 					     Library Functions Manual						   explain_nice(3)

NAME
explain_nice - explain nice(2) errors SYNOPSIS
#include <libexplain/nice.h> const char *explain_nice(int inc); const char *explain_errno_nice(int errnum, int inc); void explain_message_nice(char *message, int message_size, int inc); void explain_message_errno_nice(char *message, int message_size, int errnum, int inc); DESCRIPTION
These functions may be used to obtain explanations for errors returned by the nice(2) system call. explain_nice const char *explain_nice(int inc); The explain_nice function is used to obtain an explanation of an error returned by the nice(2) system call. The least the message will con- tain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. inc The original inc, exactly as passed to the nice(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. Example: This function is intended to be used in a fashion similar to the following example: int result = nice(inc); if (result < 0) { fprintf(stderr, "%s ", explain_nice(inc)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_nice_or_die(3) function. explain_errno_nice const char *explain_errno_nice(int errnum, int inc); The explain_errno_nice function is used to obtain an explanation of an error returned by the nice(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. inc The original inc, exactly as passed to the nice(2) system call. Returns: The message explaining the error. This message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. This will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. Note: This function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. Example: This function is intended to be used in a fashion similar to the following example: int result = nice(inc); if (result < 0) { int err = errno; fprintf(stderr, "%s ", explain_errno_nice(err, inc)); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_nice_or_die(3) function. explain_message_nice void explain_message_nice(char *message, int message_size, int inc); The explain_message_nice function is used to obtain an explanation of an error returned by the nice(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. The errno global variable will be used to obtain the error value to be decoded. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. inc The original inc, exactly as passed to the nice(2) system call. Example: This function is intended to be used in a fashion similar to the following example: int result = nice(inc); if (result < 0) { char message[3000]; explain_message_nice(message, sizeof(message), inc); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_nice_or_die(3) function. explain_message_errno_nice void explain_message_errno_nice(char *message, int message_size, int errnum, int inc); The explain_message_errno_nice function is used to obtain an explanation of an error returned by the nice(2) system call. The least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. message The location in which to store the returned message. If a suitable message return buffer is supplied, this function is thread safe. message_size The size in bytes of the location in which to store the returned message. errnum The error value to be decoded, usually obtained from the errno global variable just before this function is called. This is neces- sary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value of errno. inc The original inc, exactly as passed to the nice(2) system call. Example: This function is intended to be used in a fashion similar to the following example: int result = nice(inc); if (result < 0) { int err = errno; char message[3000]; explain_message_errno_nice(message, sizeof(message), err, inc); fprintf(stderr, "%s ", message); exit(EXIT_FAILURE); } The above code example is available pre-packaged as the explain_nice_or_die(3) function. SEE ALSO
nice(2) change process priority explain_nice_or_die(3) change process priority and report errors COPYRIGHT
libexplain version 0.52 Copyright (C) 2009 Peter Miller explain_nice(3)
All times are GMT -4. The time now is 04:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy