[Gambas-user] auto detect pipe |

Bruce Steers bsteers4 at gmail.com
Wed Nov 1 13:35:23 CET 2023


i have made a command that supports piping using Application_Read()

Static Public Sub Application_Read()

  $bReading = True

  While Lof(Last)
    $aArgs[0] = Last.ReadLine()
    ProcessString()
    If Not Eof(Last) And If Not $bNewLine Then Print ""
  Wend

  $bReading = False

End

it works but i have added an arg -p that if i use -p then the pipe is read.
Eg.
echo "This text" | mycommand -p

can i detect if a pipe is to be used or not automatically?

Respects
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231101/b4c62f0f/attachment.htm>


More information about the User mailing list