سؤال

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