Sponsored Content
Top Forums Shell Programming and Scripting [Perl] Capture system call error message. Post 302345471 by ejdv on Wednesday 19th of August 2009 10:07:39 AM
Old 08-19-2009
Quote:
Originally Posted by jim mcnamara
Did you try to redirect stderr into stdout inside the system "script"?
Code:
$somevar = system( "[some command ] 2&>1");

The "2&>1" is a little typo.
It has to be "2>&1".
That explains why my hostname was changed to '2' on the other host.

This works (with backticks):

Code:
my $host = "nbsol152";
my $redirect = "2>&1";
my $return;
$return = `remsh $host hostname $redirect`;
printf "return : $return\n";

That will capture all output, including the error output.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sh Prgram to capture Log message.

Hi All, I have a log file which consists of log messages as follows -> GLOBALCALLID_CLUSTERID_B NEXT * , O(") CHARACTER JOINONBEHALFOF NEXT * , O(") CHARACTER Record 1: Rejected - Error on table IFA_MMV_CDR, column CDRRECORDTYPE.... (1 Reply)
Discussion started by: rahulrathod
1 Replies

2. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

3. Shell Programming and Scripting

How to capture status code and echo a message

Im trying to execute application and its return code is below IF Status code=o echo "........" else Staus Code =-2 DJRE then echo "......" Can any one help me how to handle the status code and echo some message. (12 Replies)
Discussion started by: laknar
12 Replies

4. Shell Programming and Scripting

Lay person needs perl help solving error message

Hi, My name is Tex I am past 60 and in need of perl help. My hobby is genealogy and I am using a perl program to display my data on my web pages. I don't even know enough to know how to ask in the right way for the help I need. This program is written in perl it is open and has been updated... (2 Replies)
Discussion started by: tex
2 Replies

5. Shell Programming and Scripting

How to capture actual error message when a command fails to execute

I want to capture actual error message in case the commands I use in my shell script fails. For eg: ls -l abc.txt 2>>errorlog.txt In this case I understand the error message is written to the errorlog.txt and I assume its bacause the return code from the command ls -l abc might return 2 if... (3 Replies)
Discussion started by: prathima
3 Replies

6. Shell Programming and Scripting

PERL SSH call error

I have a Perl Script #!/usr/local/bin/perl $server_name = "info-xyz-05"; my $value = `/usr/bin/ssh -f $server_name /users/salesadm/MGFINFA/bridgerftpup.sh`; The above calls a shell script on another server called bridgerftpup.sh. This script has several commands and needs to call... (2 Replies)
Discussion started by: alfredo123
2 Replies

7. 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

8. Shell Programming and Scripting

Capture all error message in Log file and send the Log file by email

Hi I have a requirement to write a script to capture all errors in a Logfile and send the file in email. If there is any error occurred the subject of email will be ERROR , If there are no error occurred the subject of email will be SUCCESS. So I created a Log file and put the Appropriate... (2 Replies)
Discussion started by: dgmm
2 Replies

9. Programming

C: error in wait system call

i made this program but when i compile this code, compiler make this error, is an error on wait() system call but argumenti is right, or not?: esercizio.c:80:9: error: incompatible type for argument 1 of ‘wait' /usr/include/i386-linux-gnu/sys/wait.h:116:16: note: expected ‘__WAIT_STATUS' but... (4 Replies)
Discussion started by: tafazzi87
4 Replies
PVM(1PVM)							  PVM Version 3.4							 PVM(1PVM)

NAME
pvm - PVM version 3 console SYNOPSIS
pvm [ -options ] [ hostfile ] DESCRIPTION
Pvm is a stand alone PVM task which allows the user to interactively query and modify the virtual machine. The console can be started and stopped multiple times on any of the hosts in the virtual machine without affecting PVM or any applications that may be running. When started pvm determines if PVM is already running and if not automatically executes pvmd3 on this host, passing pvmd3 the command line options and host file. Thus PVM need not be running to start the console. Once started the console prints the prompt: pvm> The following console commands are available: add hostname(s) - Add hosts to virtual machine alias - Define/list command aliases conf - List virtual machine configuration delete hostname(s) - Delete hosts from virtual machine echo - Echo arguments export - Add environment variables to spawn export list halt - Stop pvmds help [command] - Print helpful information about a command id - Print console task id jobs - List running jobs kill task-tid - Terminate tasks mstat host-tid - Show status of hosts ps -a - List all PVM tasks pstat task-tid - Show status of tasks quit - Exit console reset - Kill all tasks setenv - Display/set environment variables sig signum task - Send signal to task spawn [opt] a.out - Spawn task opts are: -(count) number of tasks, default is 1 -(host) spawn on host, default is any -(ARCH) spawn on hosts of ARCH -? enable debugging -> redirect task output to console -> file redirect task output to file ->>file redirect task output append to file trace - Set/display trace event mask unexport - Remove environment variables from spawn export list unalias - Undefine command alias version - Show libpvm version pvm reads $HOME/.pvmrc before reading commands from the tty, so it can be used to customize the console environment, for example: alias ? help alias j jobs setenv PVM_EXPORT DISPLAY # print my id echo new pvm shell id EXAMPLES
pvm Starts up pvmd3 on the local host or connects to running pvmd3. pvm hostfile Starts up console and pvmd3, which in turn reads the host file and adds the listed computers to the virtual machine. SEE ALSO
pvm_intro(1PVM), pvmd3(1PVM) 30 August, 1993 PVM(1PVM)
All times are GMT -4. The time now is 01:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy