05-30-2010
Perl: Tee system-command to SYSOUT and @array? (not > file)
Hi - Within perl I want to execute a system command. I want to re-direct all the output from the command to a file (@result = `$cmd`
, but I ALSO want the results to be displayed on the screen (system("$cmd");
The reason is this - if the command completes, I want to process the output. If the command -hangs- (trying to debug a system problem), I want the output on the screen so I can see how far the command got.
Any easy way to do this in perl?
Thanks!
/j
Last edited by jeffw_00; 05-30-2010 at 05:42 PM..
10 More Discussions You Might Find Interesting
1. UNIX Desktop Questions & Answers
Does anyone can write a thread to teach me how to install Windows 2000, RH Linux, and FreeBSD unix in one machine step by step? Or someone's already done with this topic? (1 Reply)
Discussion started by: HOUSCOUS
1 Replies
2. Ubuntu
I am a stranger here ,where can i get the operation for free.thank you! (2 Replies)
Discussion started by: tcb3210
2 Replies
3. UNIX for Dummies Questions & Answers
hi, all,
i saw a syntax like this
usr/local/mpiexec -np 8 /home/XXXX/program_exe >& ./temp/out
the output will be put into ./temp/out.
I want to know the meaning of the operation symbol '>&'.
Thanks (3 Replies)
Discussion started by: cy163
3 Replies
4. Shell Programming and Scripting
Hi Everyone,
i have a string 00:44:40
so:
$tmp=~ s/://gi;
$tmp=~s/({2})({2})({2})/$1*3600+$2*60+$3/e;
the output is 2680.
Any way to combine this two lines into a single line?
Thanks (4 Replies)
Discussion started by: jimmy_y
4 Replies
5. Shell Programming and Scripting
When trying to use backticks for system commands, is there a way to read the error messages if a command doesn't execute properly?
I have no problem getting the results if the command is properly executed.
Ex.
my @result = `dir`;
foreach my $line (@result) {
print "Result = $line";... (2 Replies)
Discussion started by: kooshi
2 Replies
6. Linux
Am actually am new to the linux operating system and knda wana knw more about it.Please could u help me with some commands so i can start with that first.Really need your help (5 Replies)
Discussion started by: GODBLESSME
5 Replies
7. UNIX for Dummies Questions & Answers
Are system calls atomic operations?
Is a system call can be interrupted? (2 Replies)
Discussion started by: vistastar
2 Replies
8. Shell Programming and Scripting
I am trying to enter a third column in this file, but the third column should that I call "Math" perform a some math calculations based on the value found in column #2.
Here is the input file:
Here is the desired output:
Output
GERk0203078$ Levir Math
Cotete_1... (5 Replies)
Discussion started by: Ernst
5 Replies
9. AIX
I can get my AIX servers to show up in SCOM but I'm struggling with running personal scripts and have the result of these scripts show up in SCOM.
I'm currently using BigBrother and I've written some scripts for BB. I would like to convert these scripts to something that can be used in SCOM.
... (0 Replies)
Discussion started by: petervg
0 Replies
10. Shell Programming and Scripting
Hi All,
I want to display the distinct values in the file and for each distinct value how may occurance or there.
Test data:
test1.dat
20121105
20121105
20121105
20121105
20121106
20121106
20121106
20121105
I need to display the output like
Output (2 Replies)
Discussion started by: bbc17484
2 Replies
LEARN ABOUT REDHAT
bos_exec
BOS_EXEC(8) AFS Command Reference BOS_EXEC(8)
NAME
bos_exec - Executes a command on a remote server machine
SYNOPSIS
bos exec -server <machine name> -cmd <command to execute>
[-cell <cell name>] [-noauth] [-localauth] [-help]
bos e -s <machine name> -cm <command to execute>
[-ce <cell name>] [-n] [-l] [-h]
DESCRIPTION
The bos exec command executes the indicated command on the file server machine named by the -server argument. Its intended use is to reboot
the machine, using the /sbin/reboot command or equivalent.
OPTIONS
-server <machine name>
Indicates the server machine on which to execute the command. Identify the machine by IP address or its host name (either fully-
qualified or abbreviated unambiguously). For details, see bos(8).
-cmd <command to execute>
Specifies the complete local disk pathname of the command to execute (for example, /sbin/reboot). Surround this argument with double
quotes ("") if the command contains one or more spaces.
-cell <cell name>
Names the cell in which to run the command. Do not combine this argument with the -localauth flag. For more details, see bos(8).
-noauth
Assigns the unprivileged identity "anonymous" to the issuer. Do not combine this flag with the -localauth flag. For more details, see
bos(8).
-localauth
Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. The bos command interpreter presents the ticket
to the BOS Server during mutual authentication. Do not combine this flag with the -cell or -noauth options. For more details, see
bos(8).
-help
Prints the online help for this command. All other valid options are ignored.
EXAMPLES
The following command reboots the machine "fs2.abc.com". The issuer has previously issued the bos shutdown command to shutdown all
processes cleanly.
% bos exec -server fs2.abc.com -cmd /sbin/shutdown -r now
PRIVILEGE REQUIRED
The issuer must be listed in the /etc/openafs/server/UserList file on the machine named by the -server argument, or must be logged onto a
server machine as the local superuser "root" if the -localauth flag is included.
The bos exec command is not available on servers running in restricted mode.
SEE ALSO
bos(8)
COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved.
This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas
Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell.
OpenAFS 2012-03-26 BOS_EXEC(8)