So I have this script that changes the color of the text in the console. The problem is that although it accepts a string from both STDIN and the -s
argument, it will occasionally leave out STDIN in the result. I have only noticed this when I pipe the script to itself (see below)
php color.php -s Hello, -c green -S underline | php color.php -s " Bob" -c red -S bold
The bash script above would always show " Bob" but would only show "Hello," a few times in a series of tries, without changing any part of the script. As far as I can tell, whether it includes it or not is very random, there is no noticeable pattern.
So my question is, how do I prevent this?