Pregunta

I am trying to write a simple shell script to apply letter replacements to a string, and I am unable to apply several in a row.

The following is the simplest example that I cannot get to work:

#!/bin/bash
tr a b |  tr b c

Now, if I run this script and enter 'a', there is no output.

¿Fue útil?

Solución

The pipe won't flow until end of data is detected. Try typing 'a' [enter] ctrl-D or use the following:

echo a | tr a b | tr b c
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top