Sponsored Content
Top Forums Shell Programming and Scripting Redirecting to standard output from within called script Post 302078575 by vish_indian on Monday 3rd of July 2006 12:53:12 AM
Old 07-03-2006
Re:

Hi,


Make the following changes in b.sh

echo "abcd" | tee /dev/tty

This should do the trick and you would get the data in the file as well as standard output.


PS: Sorry, i just noticed that you wanted changes done in a.sh and not b.sh. Please ignore this one.

Last edited by vish_indian; 07-03-2006 at 06:09 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

file content to standard output from a script

hi folks how do i output contents of file in standard output. in my script, i say x=`cat filename' echo $x below is the actual file *********** asda afdf fdf sdf dsfsdfsd fds dsfdfsdfsdg ssgd sgdg sdfsdgfsdg dgfd gsfd gs sdg sfdg s in my script, i am trying to output the... (4 Replies)
Discussion started by: bryan
4 Replies

2. Shell Programming and Scripting

redirecting SQL output from within a shell script

Hi all I would like to open a SQL session from within a shell script and then redirect the output of the SQL command to a file. e.g. #!/bin/bash sqlplus "/ as sysdba" <<EOF @$HOME/recovery_space.sql EOF I want to redirect the output of the SQL command to a temp file, because... (2 Replies)
Discussion started by: soliberus
2 Replies

3. UNIX for Dummies Questions & Answers

Redirect Standard output and standard error into spreadsheet

Hey, I'm completely new at this and I was wondering if there is a way that I would be able to redirect the log files in a directories standard output and standard error into and excel spreadsheet in anyway? Please remember don't use too advanced of terminology as I just started using shell... (6 Replies)
Discussion started by: killaram
6 Replies

4. Shell Programming and Scripting

Redirecting standard error issues.

Hello Friends, Good Day. I am trying to redirect a standard error to the bit bucket(/dev/null) but it is not working. Though, it is working fine in redirecting the standard output. Below is the output of my script without any redirection: $ ./CheckVSSLocks.sh... (16 Replies)
Discussion started by: singh.chandan18
16 Replies

5. UNIX for Dummies Questions & Answers

redirecting the script output to more than 1 file

Hi, I want to redirect my script output to more than one file without printing the result to the screen. How to do that? ex: echo "hi" >> a.txt b.txt cat a.txt hi b.txt :confused: (2 Replies)
Discussion started by: boopathyvasagam
2 Replies

6. UNIX for Dummies Questions & Answers

redirecting script output

Hello, I am interested in taking the output from a script i wrote and using it as input to a different script i wrote. So for example i want to take the output from program2 and use it as a parameter for program1. I didnt think i could use the >> symbols because i think that is just for .txt... (4 Replies)
Discussion started by: GmGeubt
4 Replies

7. Shell Programming and Scripting

Redirecting script output to terminal

When ever i started my terminal,Every time I have to change the directory like "cd user/documents/ravi/folder2/folder3" Without typing this entire command every time ,I placed "alias c='cd user/documents/ravi/folder2/folder3'" in .bash_profile file. so that i can able to execute command 'c'... (6 Replies)
Discussion started by: Raviteja saddal
6 Replies

8. Shell Programming and Scripting

Redirecting output for the entire script

Hi All, I am trying to redirect output for every line in a korn shell script that is going to generate output and append it to a log file. I have been doing this after EACH and every line that is going to produce output: command 1 >> test.log command 2 >> test.log command 3 >>... (5 Replies)
Discussion started by: MIA651
5 Replies

9. Shell Programming and Scripting

Redirecting command output to a file in a shell script

Hello All, I have some unique requirement. I have written a very lengthy script which calls number of resource script to execute a particular task. What I want is output of each command(called from main script and resource scripts) should go to a... (3 Replies)
Discussion started by: anand.shah
3 Replies

10. Shell Programming and Scripting

Need output of script on screen and file with correct return status of the called script.

Hi, I am trying to capture logs of the script in the file as well as on the screen. I have used exec and tee command for this. While using exec command I am getting the correct output in the file but, script output is not getting displayed on the screen as it get executed. Below is my sample... (14 Replies)
Discussion started by: Prathmesh
14 Replies
tty(1)							      General Commands Manual							    tty(1)

NAME
tty - Returns pathname of terminal device SYNOPSIS
tty [-s] The tty command writes the full pathname of your terminal device to standard output. The tty command may also be used to determine if standard input is a terminal. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: tty: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Suppresses reporting the pathname. The XCU specification states that -s option is obsolete and recommends the portable applications use test -t 0 instead of tty -s. OPERANDS
None DESCRIPTION
The command tty -s evaluates as TRUE if standard input is a display and FALSE if it is not. [Tru64 UNIX] The file /dev/tty is a special file always refers to your controlling terminal, although it also may have another name like /dev/console or /dev/tty2. To avoid writing undesirable output to an output file--for example, to write a prompt in a shell script to the screen, while writing the response to the prompt to an output file--redirect standard output to /dev/tty. NOTES
While the -s option is useful if only the exit code is wanted, it does not rely on any ability to form a valid pathname. For a portable application you should use the command test -t 0. EXIT STATUS
The following exit values are returned: Successful completion. Standard input is not a display. [Tru64 UNIX] Invalid options specified. [Tru64 UNIX] An error occurred. DIAGNOSTICS
[Tru64 UNIX] Your standard input is not a display and you did not specify the -s option. EXAMPLES
To display full pathname of your terminal device, enter: tty To test whether or not the standard input is a terminal device, create a shell script containing the following: if tty -s then echo 'Output is a display' else echo 'Output is not a display' fi If the standard input is a terminal device, this displays the Output is a display message. If the standard input is not a terminal device, it displays the Output is not a display message. ENVIRONMENT VARIABLES
The following environment variables affect the execution of tty: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for- mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. FILES
Pseudodevice representing the user's controlling terminal. SEE ALSO
Commands: stty(1), test(1) Routines: ttyname(3) Files: tty(7) Standards: standards(5) tty(1)
All times are GMT -4. The time now is 08:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy