StdOut to StdErr
Verfasst: 18.01.2022 19:55
Hallo Leute,
ich habe da mal wieder eine Frage.
Wie kann ich dieses Bash-Konstrukt:
in PureBasic nachbilden?
Beispiel:
Danke!
Diese Befehle funktionieren nicht, oder ich wende sie höchstwahrscheinlich falsch an.
ich habe da mal wieder eine Frage.
Wie kann ich dieses Bash-Konstrukt:
Code: Alles auswählen
3>&2 2>&1 1>&3
Beispiel:
Code: Alles auswählen
#dialog = "whiptail"
;...
Procedure.i Termi_yesno(*this.termi_t, title.s, text.s, height.i, width.i, options.s="")
Protected exit.i, prog.i
If *this\run
prog = RunProgram(#dialog, UnescapeString(options) + ~"--clear --title \"" + title + ~"\" --yesno \"" + text + ~"\" " + Str(height) + " " + Str(width), "", #PB_Program_Open | #PB_Program_Wait)
If IsProgram(prog)
While ProgramRunning(prog)
;...
Wend
exit = ProgramExitCode(prog)
CloseProgram(prog)
ProcedureReturn exit
EndIf
Else
ProcedureReturn -1
EndIf
EndProcedure
;...
prog = RunProgram(#dialog, "3>&2 2>&1 1>&3 "+ UnescapeString(options) + ~" --inputbox \"" + text + ~"\" " + Str(height) + " " + Str(width) + " " + init, "", #PB_Program_Open | #PB_Program_Error | #PB_Program_Wait)
;...
Diese Befehle funktionieren nicht, oder ich wende sie höchstwahrscheinlich falsch an.
Code: Alles auswählen
!dup2(2, 3);
!dup2(1, 2);
!dup2(3, 1);
!close(3);