Piping program output to another program in a Shell

domenikov · 361

domenikov

  • Newbie
  • *
    • Posts: 6
    • Karma: +0/-0
on: October 11, 2021, 12:32:14 PM
Good morning to all,
I'm trying to chain several program in a Shell by launching them with a pipe operator between them. Except the first, every program takes input from previous program in the chain. I adopted this syntax:

Program1 | Program2 | Program3

The input of Program2 is the output of Program1.The input of Program3 is the output of Program2. Every program makes use of normal STDIO.

This doesn't work under AROS, works fine under OS4 and MorphOS. The syntax is different under AROS?
 
Regards,
Domenico



deadwood

  • AROS Developer
  • Senior Member
  • *****
    • Posts: 453
    • Karma: +28/-0
Reply #1 on: October 11, 2021, 05:39:08 PM
I don't know if this will help, but I recall I had more success with PIPE: handler than with | piping.

Example:

LibList >PIPE:o1
grep "arosc.library" <PIPE:o1 >PIPE:o2



domenikov

  • Newbie
  • *
    • Posts: 6
    • Karma: +0/-0
Reply #2 on: October 11, 2021, 10:17:21 PM
Thanks, but this doesn't work for me.

I tried also this type of syntax...

program1 | program2 in: | program3 in:

...suggested in this page:

https://aros.sourceforge.io/documentation/users/shell/introduction.php

By using fake device "in:" is possible to give a program an handler to make it work a program who requires an input file. However, my programs DOESN'T work on files, but sends/receives continuous data streams.

This syntax failed also, after many tries. Note: That page confirm my original syntax ( program1 | program2 | ... ).



AMIGASYSTEM

  • Legendary Member
  • *****
    • Posts: 1057
    • Karma: +34/-1
  • AROS One
    • AROS One
Reply #3 on: October 11, 2021, 11:01:44 PM
Ciao Domenico, i'm not a developer but I'm quite familiar with AmigaOS and AROS, could you attach some example files that don't work, I'd like to try them a bit.


domenikov

  • Newbie
  • *
    • Posts: 6
    • Karma: +0/-0
Reply #4 on: October 12, 2021, 06:56:03 PM
Thanks, I can write you a PM, tell me in which language (italian or english, italian preferred).



AMIGASYSTEM

  • Legendary Member
  • *****
    • Posts: 1057
    • Karma: +34/-1
  • AROS One
    • AROS One
Reply #5 on: October 12, 2021, 07:17:50 PM
If you know Italian it would be preferable, I translate English with google translator :)


AMIGASYSTEM

  • Legendary Member
  • *****
    • Posts: 1057
    • Karma: +34/-1
  • AROS One
    • AROS One
Reply #6 on: October 12, 2021, 11:29:28 PM
Domenico confirm, on AROS only the first executable starts, I had to replace the executables because yours gave an error on the Hollywood Player.

I also tested it on OS3, with this OS the script is not supported.

About your game I know it, some time ago we discussed HERE on Amiganews.it.


----------   Italiano  -----------------


Domenico confermo, su AROS si avvia solo il primo eseguibile, ho dovuto sostituire gli eseguibili perchè i tuoi davano un errore sul Player Hollywood.

Testato anche su OS3, con questo OS lo script non è supportato.

Riguardo il tuo gioco lo conosco, qualche tempo fa abbiamo discusso QUI su Amiganews.it.



domenikov

  • Newbie
  • *
    • Posts: 6
    • Karma: +0/-0
Reply #7 on: October 13, 2021, 12:59:22 AM
I don't understand in which sense you tell "replace the executables". You replaced one or more of my executables with something else during tests (?)



cdimauro

  • Junior Member
  • **
    • Posts: 57
    • Karma: +1/-1
Reply #8 on: October 13, 2021, 06:32:39 AM
If you know Italian it would be preferable, I translate English with google translator :)
Google Translator sucks: try deepl.com



AMIGASYSTEM

  • Legendary Member
  • *****
    • Posts: 1057
    • Karma: +34/-1
  • AROS One
    • AROS One
Reply #9 on: October 13, 2021, 09:22:30 AM
Thanks cdimauro, in some cases I use Google Translator but almost always I use deepl.com
« Last Edit: October 13, 2021, 09:54:04 AM by AMIGASYSTEM »