Sponsored Content
Top Forums Shell Programming and Scripting Running a script in system() call and want the script's output Post 302451798 by Franklin52 on Wednesday 8th of September 2010 05:26:36 AM
Old 09-08-2010
Quote:
Originally Posted by amio
Hi All,

I have a script(sample.sh) displaying the output of "dd" command. Now i am using this script in system() call as,

system("sh sample.sh") in an application file.

I want the output of system("sh sample.sh") in the application file itself.

How can i get it?

Many thnaks.
amio
In what programming language is your application written?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

a system call for sed in a awk script

Hi, this is my test file : DELETE FROM TABLE WHERE ID_INTERNAL = :TABLE.ID-INTERNAL, ID-INTERNAL-CRAZY ID-INTERNAL-OPEN ID-INTERNAL /ID-INTERNAL/ I want all occurences of ID-INTERNAL replaced with a one, if ID-INTERNAL has and dash afer it , dont replace it example:... (6 Replies)
Discussion started by: seaten
6 Replies

2. Programming

Need help with running the tar command using system() call in C

Hey everyone, I've been trying to use the system(cmd) call in C to tar multiple files together. When i do so i specify the absolute paths of the tar file as well as the files to be included in the tar file. Eg: system("tar -cf /tmp/example.tar /mnt/john/1.xml"); system("tar -uf... (5 Replies)
Discussion started by: vsanjit
5 Replies

3. Shell Programming and Scripting

Passing argument to system call in awk script

So, I have this script. It reads a CSV file that has a mixture of object names with IP addresses (parsing out that part I have working), and object names which have a DNS name. I want to be able to run a "dig +short" based off of the name given to me in the line of the awk script, and then deal... (6 Replies)
Discussion started by: mikesimone
6 Replies

4. Shell Programming and Scripting

Call and redirect output of Oracle stored procedure from unix script

Hi, Can you assist me in how to redirect the output of oracle stored procedure from unix script? Something similar to what i did for sybase isql -U$MYDBLOG -D$MYDBNAME -S$MYDBSVR -P$MYDBPWD -o$MYFILE<< %% proc_my_test 8 go %% Thanks in advance - jak (0 Replies)
Discussion started by: jakSun8
0 Replies

5. Shell Programming and Scripting

Script not running from cron it gives blank output

Hi, I have ascript which drops a mail with the jobs status. here is the script: #!/bin/ksh mypath=/home/gaddamja flashlogpath=/sbcimp/dyn/data/flash/log cd $mypath v1=`ls -lrt | grep -i checkFilesForAmber_EUR1. |tail -1 | awk '{print $8}'` v2=`cat $v1` cd $flashlogpath ... (1 Reply)
Discussion started by: jagadish_gaddam
1 Replies

6. Shell Programming and Scripting

How to call the System command twice in the same perl script...

Hello experts, I have a perl script which looks for the ARGV and then loads the data as per it. Example. #Checking the server to connect if ($ARGV eq 'QA') { $ENV{"ORACLE_HOME"} = "/oracle/product/11.2.0"; $ENV{"PATH"} = "$ENV{'PATH'}:/oracle/product/11.2.0/bin"; ... (1 Reply)
Discussion started by: msrahman
1 Replies

7. Shell Programming and Scripting

Running same script through cron gives different output

Hi All, I am running the below shell script through cron and surprisingly it gives different output $uname -a Linux 2.6.18-194.3.1.7.3.el5xen #1 SMP Fri Jul 30 00:08:45 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux $ echo $SHELL /bin/bash shell script: cat sar_cpu.sh #!/bin/bash ... (10 Replies)
Discussion started by: a1_win
10 Replies

8. Shell Programming and Scripting

Shell script to call Oracle archive backup script when file system reaches threshold value

Hello All, I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60% Need to identify the unique file system that reaches threshold value. ex: capacity ... (4 Replies)
Discussion started by: sasikanthdba
4 Replies

9. Programming

Running java script from piped output

to run most other scripts through a pipe, something similar to the following is usually enough: cat script.sh | sh cat perl.pl | perl -- "<arguments" However, for javascript command line scripts, i cant seem to get this to work. Any ideas? cat hull.js #!/usr/bin/js ... (3 Replies)
Discussion started by: SkySmart
3 Replies

10. UNIX for Beginners Questions & Answers

Shell script to call and sort awk script and output

I'm trying to create a shell script that takes a awk script that I wrote and a filename as an argument. I was able to get that done but I'm having trouble figuring out how to keep the header of the output at the top but sort the rest of the rows alphabetically. This is what I have now but it is... (1 Reply)
Discussion started by: Eric7giants
1 Replies
sample(1)						    BSD General Commands Manual 						 sample(1)

NAME
sample -- Profile a process during a time interval SYNOPSIS
sample pid | partial-executable-name [duration [samplingInterval]] [-wait] [-mayDie] [-fullPaths] [-e] [-file filename] DESCRIPTION
sample is a command-line tool for gathering data about the running behavior of a process. It suspends the process at specified intervals (by default, every 1 millisecond), records the call stacks of all threads in the process at that time, then resumes the process. The analysis done by sample is called ``sampling'' because it only checks the state of the program at the sampling points. The analysis may miss execu- tion of some functions that are not executing during one of the samples, but sample still provides useful data about commonly executing func- tions. At the end of the sampling duration, sample produces a report showing which functions were executing during the sampling. The data is con- densed into a call tree, showing the functions seen on the stack and how they were called. (This tree is a subset of the actual call tree for the execution, since some functions may not have been executing during any of the sampling events.) The tree is displayed textually, with called functions indented one level to the right of the callee. In the call tree, if a function calls more than one function then a vertical line is printed to visually connect those separate children functions, making it easier to see which functions are at the same level. The characters used to draw those lines, such as + | : ! are arbi- trary and have no specific meaning. ARGUMENTS
The user of sample specifies a target process (either by process id, or by name), the duration of the sampling run (in seconds), and a sam- pling rate (in milliseconds). If the sampling duration is not specified, a default of 10 seconds is used. Longer sampling durations provide better data by collecting more samples, but could also be confusing if the target process performs many different types of operations during that period. The default sampling rate is 1 millisecond. Fast sampling rates provide more samples and a better chance to capture all the functions that are executing. -wait tells sample to wait for the process specified (usually as a partial name or hint) to exist, then start sampling that process. This option allows you to sample from an application's launch. -mayDie tells sample to immediately grab the location of symbols from the application, on the assumption that the application may exit or crash at any point during the sampling. This ensures that sample can give information about the call stacks even if the process no longer exists. -fullPaths tells sample to show the full path to the source code (rather than just the file name) for any symbol in a binary image for which debug information is available. The full path was the path to the source code when the binary image was built. -e tells sample to open the output in TextEdit automatically when sampling completes. -file filename tells sample the full path to where the output should be written. If this flag is not specified, results are written to a file in /tmp called <application name>_<date>_<time>.<XXXX>.sample.txt, where each 'X' is replaced by a random alphanumeric character. If neither the -e nor -file flags are given, the output gets written to stdout as well as saved to the file in /tmp. SEE ALSO
filtercalltree(1), spindump(8) The Xcode developer tools also include Instruments, a graphical application that can give information similar to that provided by sample. The Time Profiler instrument graphically displays dynamic, real-time CPU sampling information. BSD
Mar. 16, 2013 BSD
All times are GMT -4. The time now is 05:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy