If I run the commands bellow, only out1
has output, the out2
and out3
are empty.
# this is just to generate a self-signed certificate
openssl genrsa -out /tmp/ssl.key 2048
openssl req -sha256 -new -key /tmp/ssl.key -out /tmp/ssl.csr -subj /CN=localhost
openssl x509 -req -days 365 -in /tmp/ssl.csr -signkey /tmp/ssl.key -out /tmp/ssl.crt
# works
openssl s_server -cert /tmp/ssl.crt -key /tmp/ssl.key -accept 444 > out1
# does not work, but if I run without '> out2' it works
openssl s_server -cert /tmp/ssl.crt -key /tmp/ssl.key -accept 446 | sed "s/ACCEPT/ACCEPT445/g" > out2
# does not work, but if I run without '> out3' it works
openssl s_server -cert /tmp/ssl.crt -key /tmp/ssl.key -accept 447 | grep ACCEPT > out3
Why does redirecting stdout from sed or grep fail, but running without redirecting works ?