Sponsored Content
Top Forums Shell Programming and Scripting script hangs when reading from stdin Post 302494257 by Corona688 on Sunday 6th of February 2011 01:28:47 PM
Old 02-06-2011
Are you sure the program is printing them to stdout? Usually they go to stderr.

Last edited by Corona688; 02-06-2011 at 02:37 PM..
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

Help:error in reading from stdin

void redirect(int argc, char *argv) { int flag; if (strcmp(argv, ">") == 0) flag = 1; else if (strcmp(argv, "<") == 0) flag = 2; else if (strcmp(argv, ">>") == 0) flag = 3; else printf("Something Wrong,Please Check!\n"); switch (flag) {... (5 Replies)
Discussion started by: zhshqzyc
5 Replies

2. Shell Programming and Scripting

Script Hangs!

Hi, I have script which is based on TCL and expect. It is written to test my code. It usually runs fine for a while and hangs after sometime. Code snippet set l_temp_timeout $timeout OUTPUT_LOG2 2 >>>$expect_out(buffer)<<< OUTPUT_LOG2 2... (2 Replies)
Discussion started by: naveenpn
2 Replies

3. Shell Programming and Scripting

Cannot redirect to STDIN in a shell script

I am unable to use STDIn redirection with < (commands) When I do the following, both approaches work and give the same results: 1. $ printf "aaa\nbbb\n" > file1 $ printf "111\n222\n" > file2 $ cat file1 file2 aaa bbb 111 2222. $ cat <(printf "aaa\nbbb\n") <(printf "111\n222\n") aaa... (8 Replies)
Discussion started by: metaltree
8 Replies

4. Shell Programming and Scripting

reading from stdin in a shell script

Hello, I've managed to get my .procmailrc file to work. At least it triggers a script which creates a file. But the file is empty. How do I get at the data that's been piped? I've done much creative googling to no avail. I belive it should be in stdin, but I can't figure out how to access... (4 Replies)
Discussion started by: mmesford
4 Replies

5. Shell Programming and Scripting

Shell script to pass multiple stdin to prorgam?

Running on AIX 5.3L. I have a program "foo" written in Fortran that requires 3 levels of inputs from stdin (command prompt). > foo Enter Input 1: a Enter Input 2: b Enter Input 3: c running foo success! > How do I get a shell script to run this automatically? > echo "a" | foo... (2 Replies)
Discussion started by: discoganya
2 Replies

6. Shell Programming and Scripting

Suplying stdin input within script

Hi , I have script in that , i uninstall rpm using rpm -ef $rc1 now my query is rpm -ef is asking user input DO YOU Want To continue (YES/NO) for each uninstalltion. now i want to supply YES variable when it asks for above statement . so that i dont have to give user input from... (4 Replies)
Discussion started by: raghavendra.nsn
4 Replies

7. Shell Programming and Scripting

Passing stdin value into a script that is called from another script

I'm trying to automatically pass user input values into a script that is being called from another script, below is my current script and I added a comment next to the script where it asks user to enter input value. Thanks, mbak #!/bin/ksh echo " Adding disks for DB server then Enter YES... (2 Replies)
Discussion started by: mbak
2 Replies

8. UNIX for Beginners Questions & Answers

How to use stdin as argument for script?

Say I had an extremely simple script called testScript.sh: #!/bin/sh echo $1 and I invoked it as: source testScript.sh <<< x or source testScript.sh <<< inputFile.txt When I do the above the values don't appear in the echo statement, and I know that is because in the echo... (5 Replies)
Discussion started by: steezuschrist96
5 Replies

9. Shell Programming and Scripting

Accept data from file or stdin in script

I have a script that looks like this:sed -f myfile.sed $1 > $1.out called myscript and would like to change it so the parameter isn't necessary: ls *.idx | myscript | xargs some_command What do I need to add so it can run either way? TIA ---------- Post updated at 09:41 AM ----------... (1 Reply)
Discussion started by: wbport
1 Replies

10. Shell Programming and Scripting

Need help with the Script to pass stdin in run time

I have put a script inside bash_profile of user "root". That script executes when we do "sudo su -" and prompts with a question : "Why are you logginf as root?" and users have to pass the reason then they get prompt. Inside script we have used "read -p input" to take input from user. I am a... (3 Replies)
Discussion started by: shekhar_4_u
3 Replies
Devel::DollarAt(3pm)					User Contributed Perl Documentation				      Devel::DollarAt(3pm)

NAME
Devel::DollarAt - Give magic abilities to $@ SYNOPSIS
use Devel::DollarAt; eval "0/0"; print $@, $@->backtrace; $@->redie; DESCRIPTION
Using eval {}, you may catch Perl exceptions almost like you do it with try {} in Java. However there are days when you miss some features of exceptions. The only thing you know about the error that occured is the string $@, which combines the error message and technical data like the line number. The Devel::DollarAt module gives some functionality to the $@ scalar. Once you say "use Devel::DollarAt", the module is active program- wide. If an exception occurs anywhere in any module, $@ will be globally set to an object of class Devel::DollarAt. Apart from performance, this shouldn't be a problem because $@ tries to be downwardly compatible to the normal $@. However using this package in CPAN modules or large software projects is discouraged. DISCLAIMER
Use this module only for debugging. Don't think of it as an exception framework for Perl or something like that. It just gives magic abilities to $@, that's all. METHODS
backtrace Returns a Devel::Backtrace object, which lets you inspect the callers of the fatality. filename Returns the name of the file in which the error occured. inputhandle Returns the file handle which has most recently be read from at the time of the error. inputline Returns the line number of "$@->inputhandle" (which is $.) at the time of the error. line Returns the number of the line in which the error occured. redie Redispatches this exception to the next eval{}. redispatch_points Returns a list of objects with informations about when this exception was redispatched. Each object has got the accessors "package", "filename" and "line". In string context, the objects will look like "redispatched from FooPackage at file.pl:17 ". to_string Returns a string that looks quite like the normal $@, e. g. "Illegal division by zero at foo.pl line 42, <> line 13." Devel::DollarAt overloads the "" (stringification) operator to this method. EXAMPLES
A very simple (and pointless) way to use Devel::DollarAt is this oneliner: perl -MDevel::DollarAt -e '0/0' It bails out with "Illegal division by zero at -e line 1." and an exit status of 1, just like it would have done if you hadn't supplied -MDevel::DollarAt. This is because the magically modified $@ variable gets stringified when perl prints it as exit reason. If you actually want to see the difference, use perl -MDevel::DollarAt=frame -e '0/0' This bails out with "[[Illegal division by zero at -e line 1.]]" so you can see that something has happened. KNOWN PROBLEMS
This module requires that no other code tampers with $SIG{__DIE__} or *CORE::GLOBAL::die. A not widely known feature of Perl is that it can propagate $@. If you call die() without parameters or with an empty string or an undefined value, the error message will be "Died". However, if $@ was set to some value before this, the previous error message will be used with " ...propagated" appended: perl -e '$@="7"; die" 7 ...propagated at -e line 1. Devel::DollarAt emulates this behaviour. If you use the above example but leave out the double quotes, perl's behaviour is different as of version 5.8.8: perl -e '$@=7; die' 7 at -e line 1. Devel::DollarAt does not emulate this behaviour: perl -MDevel::DollarAt -e '$@=7; die' 7 ...propagated at -e line 1. If a previous $@ is propagated, inputhandle and inputline won't work. They won't be interpolated into the stringified $@, either. If perl comes across syntax errors, $@ appears to be just a string as usual. Apparently $SIG{__DIE__} won't be called for syntax errors. AUTHOR
Christoph Bussenius <pepe@cpan.org> If you use this module, I'll be glad if you drop me a note. You should mention this module's name in the subject of your mails, in order to make sure they won't get lost in all the spam. LICENSE
This module is in the public domain. If your country's law does not allow this module being in the public domain or does not include the concept of public domain, you may use the module under the same terms as perl itself. perl v5.10.0 2009-01-27 Devel::DollarAt(3pm)
All times are GMT -4. The time now is 04:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy