ccase icon indicating copy to clipboard operation
ccase copied to clipboard

ccase should not read stdin unless instructed

Open samodadela opened this issue 2 years ago • 0 comments

Using ccase in a while loop I noticed that it is not only coverting the value passed on the command line, but also all the standard input.

printf "a\nb\nc\n" | while read word; do
  U="$(ccase --to upper "${word}")"; 
  echo converted: $U
done

Should print:

converted: A
converted: B
converted: C

Instead it prints:

converted: A
B
C

Indicating that the loop iterated only one time.

A workaround is to give it null stdin:

printf "a\nb\nc\n" | while read word; do
  U="$(ccase --to upper "${word}" < /dev/null)"; 
  echo converted: $U
done

samodadela avatar Sep 08 '23 10:09 samodadela