I am trying to write a one-line bash script on the bash command prompt that involves input redirection:
dbs$ for $f in *; do tr '\n' '' < $f; done
but the '<' character is causing problem. Do I need to escape the < character somehow? Thanks!
It should read
dbs$ for f in *; do tr '\n' '' < $f; done
The for builtin binds the respective values that are being iterated (i.e., *) to the variable, so you cannot ask bash to expand the variable right after for.
After your Edit; The script looks fine. Your problem are being caused somewhere else.
For one thing, your invocation of tr looks wrong: You probably meant tr -d '\n'.