문제

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.

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top