Top Forums Shell Programming and Scripting Redirecting output that was redirected to variable and console Post 302372213 by aigles on Tuesday 17th of November 2009 10:30:38 AM
A possible technique :
Code:
if display required
then
   Console=/dev/tty
else
   Console=/dev/null
fi

var=$(command | tee $Console)

Jean-Pierre.
 
Test Your Knowledge in Computers #2
Difficulty: Easy
Unix was invented by Steve Jobs of Apple Computer.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Standard output not redirected from /bin/sh

I have an application which has a lot of cout & cerr statements. This application also opens a log file (for eg a.log). When this application is run from the inittab file as follows /bin/sh -c " . /etc/timezone; exec /test" all the cout & cerr statements are printed in the log file... (1 Reply)
Discussion started by: soorajmu
1 Replies

2. Shell Programming and Scripting

redirected output

Hello Everyone, I have an option for users in my shell script to create log file. So if user saying yes on it, Im redirecting all output to log file by doing this: > /output.log. However I would like the output being displayed on the screen at the same time. Is it possible? If yes, does anybody... (2 Replies)
Discussion started by: slavam
2 Replies

3. UNIX for Dummies Questions & Answers

redirected output not going to file for all cases

I have to confirm that an engine was not able to run. In the output below you see that it indeed got errors, but it didn't send those messages to the output file. When I run the same thing with a different executable it works. So does this mean something in the executable could cause it not to... (7 Replies)
Discussion started by: brdholman
7 Replies

4. Shell Programming and Scripting

problem redirecting output of command to variable

Hi. I'm a newbie in scripting and i have this problem: i want to use the 'fuser' command on a file to tell if it's being accessed (for my purposes: still being written). I want to save the output of the command and later compare with the 'not being used' result. the script: #!/bin/bash... (2 Replies)
Discussion started by: nunovc
2 Replies

5. Shell Programming and Scripting

Exclude Certain Entries from Piped or Redirected Output?

I want to execute a command something like: find / -name "jni.h" and I want to direct the output of that command to some type of filter that will leave out all the lines reporting inaccessible directories (permission unavailable). Is this a pipe or a redirect? For example, output like... (1 Reply)
Discussion started by: downplay
1 Replies

6. Shell Programming and Scripting

Redirecting output to both console and to a file

Hi All, Is there a way in Bash we can redirection some output to both console and the file at the same time. ~Parag (2 Replies)
Discussion started by: paragkalra
2 Replies

7. UNIX and Linux Applications

missing delimiters when mysql output is redirected to log file

Hi, Pls check that '|' and '+' present in Step-1 are not copied to log file in Step-3. Pls suggest how to get the exact output from Step-1 (i.e. with out losing '|' and '+') in to a log file ~Thanks Step-1: Execute command > mysql -utest -ptest -htesthost testdb -e "select * from... (3 Replies)
Discussion started by: newbielgn
3 Replies

8. UNIX for Dummies Questions & Answers

Dot and redirected output syntax in a tar command

Hi All, Please could anyone advise what the purpose of the dot syntax in the following command means: tar -cvf ${WORKING_BACKUP_ROOT}/${TAR_ARCHIVE_FILE} . >/${BACKUP_ROOT}/${ARCHIVE_LOG} Many thanks (2 Replies)
Discussion started by: daveu7
2 Replies

9. Solaris

Redirecting console output to ILOM during installation

Hi, I need to install solaris remotely via the ILOM port on a x4170 box, and I have downloaded the Solaris 11 for x86 text install image and burned it on a DVD. When I boot the box, its showing the boot_archive loading percentage on the SP console, but when its done and start the interactive... (0 Replies)
Discussion started by: u_paludan
0 Replies

10. Linux

RHEL 6.3 - chage command not redirecting the output to console.

When i am issuing chage command, it reporting the output properly. But when i redirect the output, i am not getting the output in the mentioned path. chage -l root >> /tmp/chage.txt. I need to use this into the script to capture the data. I think its seems to be bug with RHEL 6.3. Same... (3 Replies)
Discussion started by: Srini.rk1983
3 Replies
POE::Component::IRC::Plugin::Console(3pm)		User Contributed Perl Documentation		 POE::Component::IRC::Plugin::Console(3pm)

NAME
POE::Component::IRC::Plugin::Console - A PoCo-IRC plugin that provides a lightweight debugging and control console for your bot SYNOPSIS
use POE qw(Component::IRC Component::IRC::Plugin::Console); my $nickname = 'Flibble' . $$; my $ircname = 'Flibble the Sailor Bot'; my $ircserver = 'irc.blahblahblah.irc'; my $port = 6667; my $bindport = 6969; my @channels = ( '#Blah', '#Foo', '#Bar' ); my $irc = POE::Component::IRC->spawn( nick => $nickname, server => $ircserver, port => $port, ircname => $ircname, ) or die "Oh noooo! $!"; POE::Session->create( package_states => [ main => [ qw(_start irc_001 irc_console_service irc_console_connect irc_console_authed irc_console_close irc_console_rw_fail) ], ], ); $poe_kernel->run(); sub _start { $irc->plugin_add( 'Console' => POE::Component::IRC::Plugin::Console->new( bindport => $bindport, password => 'opensesame' ); $irc->yield( register => 'all' ); $irc->yield( connect => { } ); return; } sub irc_001 { $irc->yield( join => $_ ) for @channels; return; } sub irc_console_service { my $getsockname = $_[ARG0]; return; } sub irc_console_connect { my ($peeradr, $peerport, $wheel_id) = @_[ARG0 .. ARG2]; return; } sub irc_console_authed { my $wheel_id = $_[ARG0]; return; } sub irc_console_close { my $wheel_id = $_[ARG0]; return; } sub irc_console_rw_fail { my ($peeradr, $peerport) = @_[ARG0, ARG1]; return; } DESCRIPTION
POE::Component::IRC::Plugin::Console is a POE::Component::IRC plugin that provides an interactive console running over the loopback network. One connects to the listening socket using a telnet client (or equivalent), authenticate using the applicable password. Once authed one will receive all events that are processed through the component. One may also issue all the documented component commands. METHODS
"new" Takes two arguments: 'password', the password to set for *all* console connections; 'bindport', specify a particular port to bind to, defaults to 0, ie. randomly allocated; Returns a plugin object suitable for feeding to POE::Component::IRC's "plugin_add" method. "getsockname" Gives access to the underlying listener's "getsockname" method. See POE::Wheel::SocketFactory for details. OUTPUT EVENTS
The plugin generates the following additional POE::Component::IRC events: "irc_console_service" Emitted when a listener is successfully spawned. "ARG0" is the result of "getsockname", see above for details. "irc_console_connect" Emitted when a client connects to the console. "ARG0" is the peeradr, "ARG1" is the peer port and "ARG2" is the wheel id of the connection. "irc_console_authed" Emitted when a client has successfully provided a valid password. "ARG0" is the wheel id of the connection. "irc_console_close" Emitted when a client terminates a connection. "ARG0" is the wheel id of the connection. "irc_console_rw_fail" Emitted when a POE::Wheel::ReadWrite could not be created on a socket. "ARG0" is the peer's address, "ARG1" is the peer's port. AUTHOR
Chris 'BinGOs' Williams SEE ALSO
POE::Component::IRC POE::Wheel::SocketFactory perl v5.14.2 2011-12-07 POE::Component::IRC::Plugin::Console(3pm)

Featured Tech Videos

All times are GMT -4. The time now is 12:14 AM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy