Can bsh scripts could handle piped input from other commands ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Can bsh scripts could handle piped input from other commands ?

Frank Misa
Hi All,

I'd like to know if it's possible for bsh scripts to handle/access piped input from other unix commands ?
For example: If "bsh" is a script/command that launches java bsh.Interpreter...

 grep -i 'myTest' *myFiles.txt | bsh myScript
 grep -i 'myTest' *myFiles.txt > bsh myScript

I've attached one "wrapper" (that I found on the net) that allows execution of bsh scripts ?
What would this wrapper need to do to pass stdio to my bsh script -- and is this stdio "visible" from within my bean shell script.

My simple test -- see attached script: myScript -- works if I type in characters after running the script... just echos back what I type...
But the script does not work if I try to pipe those characters in from some other command ?

$ grep -i 'logging.properties' *.properties | bsh myScript.bsh
BeanShell test.... processing stdio
Done...

Following outputs nothing...
$ grep -i 'logging.properties' *.properties > bsh myScript.bsh

Was wondering -- is BeanShell used by the community in this manner ? Can it be done...
Looking forward to hearing some ideas....

Thanks
Frank


So many new options, so little time. Windows Live Messenger.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users

bsh (2K) Download Attachment
myScript.bsh (448 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Can bsh scripts could handle piped input from other commands ?

Jesse Pavel
Hi Frank,

> grep -i 'myTest' *myFiles.txt | bsh myScript

This syntax should work on Linux/Unix/etc. Perhaps piping doesn't
operate properly on Cygwin when you mix in non-Cygwin executables?

~Jesse


On Fri, Jan 30, 2009 at 2:39 PM, Frank Misa <[hidden email]> wrote:

> Hi All,
>
> I'd like to know if it's possible for bsh scripts to handle/access piped
> input from other unix commands ?
> For example: If "bsh" is a script/command that launches java
> bsh.Interpreter...
>
>  grep -i 'myTest' *myFiles.txt | bsh myScript
>  grep -i 'myTest' *myFiles.txt > bsh myScript
>
> I've attached one "wrapper" (that I found on the net) that allows execution
> of bsh scripts ?
> What would this wrapper need to do to pass stdio to my bsh script -- and is
> this stdio "visible" from within my bean shell script.
>
> My simple test -- see attached script: myScript -- works if I type in
> characters after running the script... just echos back what I type...
> But the script does not work if I try to pipe those characters in from some
> other command ?
>
> $ grep -i 'logging.properties' *.properties | bsh myScript.bsh
> BeanShell test.... processing stdio
> Done...
>
> Following outputs nothing...
> $ grep -i 'logging.properties' *.properties > bsh myScript.bsh
>
> Was wondering -- is BeanShell used by the community in this manner ? Can it
> be done...
> Looking forward to hearing some ideas....
>
> Thanks
> Frank

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Can bsh scripts could handle piped input from other commands ?

Stewart Cambridge
In reply to this post by Frank Misa

Following outputs nothing...
$ grep -i 'logging.properties' *.properties > bsh myScript.bsh


Doesn't this command mean: "Write the output of grep to two text files names 'bsh' and 'myScript.bsh'"?

The '|' symbol, which you say is working, is the one you want, surely?

Regards,

Stewart


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users