Waiting for async console (message queue) output after invoking a command [closed]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have to work with a command (lets call it update) which somehow prints its output asynchronously to the terminal (mq_timedsend). The output is not recognized as the commands output and therefore the stdout of the command is not usable (piping like update| grep -m 1 "$s" does not work). Unfortunately, I have to life with this.



Invoking the command sooner or later will print $s or $f as the creators were apparently also not aware of exit codes. I need to be able to parse after $s and $f and set the exit code manually.



I'm still not very versioned with bash and all its possibilities. How could a script or even a single chained command which will execute the update command and will wait until the specific text ($s or $f) appears in the console look like? Is this even possible?










share|improve this question















closed as unclear what you're asking by andcoz, schily, Isaac, msp9011, maulinglawns Aug 22 at 10:16


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • Are you searching for literally $s in update output? What happens if you try update | grep -m 1 -F '$s'?
    – andcoz
    Aug 21 at 12:16










  • Nothing, as the command update does not produce a direct output. It most possibly starts another background process which finally prints to the console.
    – Herr Derb
    Aug 21 at 12:23











  • Perhaps update is using STDERR, try update 2>&1 | grep -m 1 -F '$s'
    – andcoz
    Aug 21 at 14:04










  • no I'm afraid not. update &> log.txt results in an empty file while text is getting printed to the console, after the console was ready to take input again.
    – Herr Derb
    Aug 21 at 15:28






  • 1




    You should find out what processes update creates and what file descriptors it writes to. Try with e.g. strace or similar.
    – RudiC
    Aug 21 at 22:13














up vote
1
down vote

favorite












I have to work with a command (lets call it update) which somehow prints its output asynchronously to the terminal (mq_timedsend). The output is not recognized as the commands output and therefore the stdout of the command is not usable (piping like update| grep -m 1 "$s" does not work). Unfortunately, I have to life with this.



Invoking the command sooner or later will print $s or $f as the creators were apparently also not aware of exit codes. I need to be able to parse after $s and $f and set the exit code manually.



I'm still not very versioned with bash and all its possibilities. How could a script or even a single chained command which will execute the update command and will wait until the specific text ($s or $f) appears in the console look like? Is this even possible?










share|improve this question















closed as unclear what you're asking by andcoz, schily, Isaac, msp9011, maulinglawns Aug 22 at 10:16


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • Are you searching for literally $s in update output? What happens if you try update | grep -m 1 -F '$s'?
    – andcoz
    Aug 21 at 12:16










  • Nothing, as the command update does not produce a direct output. It most possibly starts another background process which finally prints to the console.
    – Herr Derb
    Aug 21 at 12:23











  • Perhaps update is using STDERR, try update 2>&1 | grep -m 1 -F '$s'
    – andcoz
    Aug 21 at 14:04










  • no I'm afraid not. update &> log.txt results in an empty file while text is getting printed to the console, after the console was ready to take input again.
    – Herr Derb
    Aug 21 at 15:28






  • 1




    You should find out what processes update creates and what file descriptors it writes to. Try with e.g. strace or similar.
    – RudiC
    Aug 21 at 22:13












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have to work with a command (lets call it update) which somehow prints its output asynchronously to the terminal (mq_timedsend). The output is not recognized as the commands output and therefore the stdout of the command is not usable (piping like update| grep -m 1 "$s" does not work). Unfortunately, I have to life with this.



Invoking the command sooner or later will print $s or $f as the creators were apparently also not aware of exit codes. I need to be able to parse after $s and $f and set the exit code manually.



I'm still not very versioned with bash and all its possibilities. How could a script or even a single chained command which will execute the update command and will wait until the specific text ($s or $f) appears in the console look like? Is this even possible?










share|improve this question















I have to work with a command (lets call it update) which somehow prints its output asynchronously to the terminal (mq_timedsend). The output is not recognized as the commands output and therefore the stdout of the command is not usable (piping like update| grep -m 1 "$s" does not work). Unfortunately, I have to life with this.



Invoking the command sooner or later will print $s or $f as the creators were apparently also not aware of exit codes. I need to be able to parse after $s and $f and set the exit code manually.



I'm still not very versioned with bash and all its possibilities. How could a script or even a single chained command which will execute the update command and will wait until the specific text ($s or $f) appears in the console look like? Is this even possible?







bash output exit-code async






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 22 at 8:06

























asked Aug 21 at 12:06









Herr Derb

1062




1062




closed as unclear what you're asking by andcoz, schily, Isaac, msp9011, maulinglawns Aug 22 at 10:16


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by andcoz, schily, Isaac, msp9011, maulinglawns Aug 22 at 10:16


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • Are you searching for literally $s in update output? What happens if you try update | grep -m 1 -F '$s'?
    – andcoz
    Aug 21 at 12:16










  • Nothing, as the command update does not produce a direct output. It most possibly starts another background process which finally prints to the console.
    – Herr Derb
    Aug 21 at 12:23











  • Perhaps update is using STDERR, try update 2>&1 | grep -m 1 -F '$s'
    – andcoz
    Aug 21 at 14:04










  • no I'm afraid not. update &> log.txt results in an empty file while text is getting printed to the console, after the console was ready to take input again.
    – Herr Derb
    Aug 21 at 15:28






  • 1




    You should find out what processes update creates and what file descriptors it writes to. Try with e.g. strace or similar.
    – RudiC
    Aug 21 at 22:13
















  • Are you searching for literally $s in update output? What happens if you try update | grep -m 1 -F '$s'?
    – andcoz
    Aug 21 at 12:16










  • Nothing, as the command update does not produce a direct output. It most possibly starts another background process which finally prints to the console.
    – Herr Derb
    Aug 21 at 12:23











  • Perhaps update is using STDERR, try update 2>&1 | grep -m 1 -F '$s'
    – andcoz
    Aug 21 at 14:04










  • no I'm afraid not. update &> log.txt results in an empty file while text is getting printed to the console, after the console was ready to take input again.
    – Herr Derb
    Aug 21 at 15:28






  • 1




    You should find out what processes update creates and what file descriptors it writes to. Try with e.g. strace or similar.
    – RudiC
    Aug 21 at 22:13















Are you searching for literally $s in update output? What happens if you try update | grep -m 1 -F '$s'?
– andcoz
Aug 21 at 12:16




Are you searching for literally $s in update output? What happens if you try update | grep -m 1 -F '$s'?
– andcoz
Aug 21 at 12:16












Nothing, as the command update does not produce a direct output. It most possibly starts another background process which finally prints to the console.
– Herr Derb
Aug 21 at 12:23





Nothing, as the command update does not produce a direct output. It most possibly starts another background process which finally prints to the console.
– Herr Derb
Aug 21 at 12:23













Perhaps update is using STDERR, try update 2>&1 | grep -m 1 -F '$s'
– andcoz
Aug 21 at 14:04




Perhaps update is using STDERR, try update 2>&1 | grep -m 1 -F '$s'
– andcoz
Aug 21 at 14:04












no I'm afraid not. update &> log.txt results in an empty file while text is getting printed to the console, after the console was ready to take input again.
– Herr Derb
Aug 21 at 15:28




no I'm afraid not. update &> log.txt results in an empty file while text is getting printed to the console, after the console was ready to take input again.
– Herr Derb
Aug 21 at 15:28




1




1




You should find out what processes update creates and what file descriptors it writes to. Try with e.g. strace or similar.
– RudiC
Aug 21 at 22:13




You should find out what processes update creates and what file descriptors it writes to. Try with e.g. strace or similar.
– RudiC
Aug 21 at 22:13















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay