Does __bma_read_stdin() really need the `tr` and `sed`?
mbailey opened this issue · comments
__bma_read_inputs() {
echo $(__bma_read_stdin) $@ |
sed -E 's/\ +$//' |
sed -E 's/^\ +//'
}
__bma_read_stdin() {
[[ -t 0 ]] ||
cat |
awk '{ print $1 }' |
tr '\n' ' ' |
sed 's/\ $//'
}
You could do it all in awk.
{ words[NR] = $1 }
END {
for (i in words) {
printf(words[i])
if (i != NR) {
printf(" ")
} else {
printf("\n")
}
}
}
It changed in Jan. The syntax might change again but not plans to change the behaviour.