Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Calling system() if certain text appears on the screen. Post 303033222 by ignatius on Monday 1st of April 2019 06:08:59 PM
Old 04-01-2019
Thanks for the reply. Would popen() be of any use?
 

6 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

screen resolution for a SPARC system

I have installed Solaris 10 on SPARC system (Ultra 5) And I'm using Acer AL1715 LCD monitor. The screen resolution is not just right. How to change the resolution Thanks in advance. (1 Reply)
Discussion started by: chaandana
1 Replies

2. Solaris

A strange user appears in my quotas and I can't find it in my system

Hello, I am running a Solaris 8 system. I Have encountered that each time I ask the system to report to me the users who have or are about to exceed their quota limit for disk usage, a strange number appears in a user name, it does not appear in my /etc/group or in my /etc/passwd files The user... (13 Replies)
Discussion started by: lzcool
13 Replies

3. Shell Programming and Scripting

Help supressing spool output from screen when calling sqlplus from script

I'm calling an embedded sql from my shell script file. This sql does simple task of spooling out the contents of the table (see below my sample code) into a spool file that I specify. So far so good, but the problem is that the output is also displayed on screen which I do NOT want. How can I... (3 Replies)
Discussion started by: MxC
3 Replies

4. Shell Programming and Scripting

Shell program to check if the same text appears twice in an XML file

Hi All, I am very new to this forum and beginner to shell scripting. I need a shell script to: Search for a text in XML file à if the same text appears twice in an XML file à output file name Script should loop thru every xml file of a given folder. Please help me writing this script. ... (1 Reply)
Discussion started by: amardeep001
1 Replies

5. Solaris

Solaris 8, you boot the system but does not have anything on the screen (not started)

Greetings to all. I have two computers, Sun Blade 150. the first, had the Solaris 8 system, and that system needed to clone the "second" to start it with the same settings. Use a program to clone the drive, and then have cloned, had the error: Can't read disk label. Can't open disk... (4 Replies)
Discussion started by: feliz-58
4 Replies

6. Shell Programming and Scripting

Print Terminal Output Exactly how it Appears in the Terminal to a New Text File

Hello All, I have a text file containing output from a command that contains lots of escape/control characters that when viewed using vi or view, looks like jibberish. But when viewed using the cat command the output is formatted properly. Is there any way to take the output from the cat... (7 Replies)
Discussion started by: mrm5102
7 Replies
POPEN(3)						   BSD Library Functions Manual 						  POPEN(3)

NAME
pclose, popen -- process I/O LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdio.h> FILE * popen(const char *command, const char *mode); int pclose(FILE *stream); DESCRIPTION
The popen() function ``opens'' a process by creating a bidirectional pipe, forking, and invoking the shell. Any streams opened by previous popen() calls in the parent process are closed in the new child process. Historically, popen() was implemented with a unidirectional pipe; hence, many implementations of popen() only allow the mode argument to specify reading or writing, not both. Because popen() is now imple- mented using a bidirectional pipe, the mode argument may request a bidirectional data flow. The mode argument is a pointer to a null-termi- nated string which must be 'r' for reading, 'w' for writing, or 'r+' for reading and writing. The command argument is a pointer to a null-terminated string containing a shell command line. This command is passed to /bin/sh, using the -c flag; interpretation, if any, is performed by the shell. The return value from popen() is a normal standard I/O stream in all respects, save that it must be closed with pclose() rather than fclose(). Writing to such a stream writes to the standard input of the command; the command's standard output is the same as that of the process that called popen(), unless this is altered by the command itself. Conversely, reading from a ``popened'' stream reads the command's standard output, and the command's standard input is the same as that of the process that called popen(). Note that output popen() streams are fully buffered, by default. The pclose() function waits for the associated process to terminate; it returns the exit status of the command, as returned by wait4(2). RETURN VALUES
The popen() function returns NULL if the fork(2) or pipe(2) calls fail, or if it cannot allocate memory. The pclose() function returns -1 if stream is not associated with a ``popened'' command, if stream already ``pclosed'', or if wait4(2) returns an error. ERRORS
The popen() function does not reliably set errno. SEE ALSO
sh(1), fork(2), pipe(2), wait4(2), fclose(3), fflush(3), fopen(3), stdio(3), system(3) BUGS
Since the standard input of a command opened for reading shares its seek offset with the process that called popen(), if the original process has done a buffered read, the command's input position may not be as expected. Similarly, the output from a command opened for writing may become intermingled with that of the original process. The latter can be avoided by calling fflush(3) before popen(). Failure to execute the shell is indistinguishable from the shell's failure to execute command, or an immediate exit of the command. The only hint is an exit status of 127. The popen() function always calls sh(1), never calls csh(1). HISTORY
A popen() and a pclose() function appeared in Version 7 AT&T UNIX. Bidirectional functionality was added in FreeBSD 2.2.6. BSD
May 3, 1995 BSD
All times are GMT -4. The time now is 08:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy