Quote:
|
Originally Posted by timb25
I am really confused...
|
And well you might be!
[a-z] and [A-Z] are
file expressions which your shell will glob out and expand if it finds any matching filenames in your working directory.
You can see what the shell is passing as tokens to tr by using echo.
e.g.
mkdir new; cd new; touch a b c; echo [a-z] [A-Z]
>>>
a b c [A-Z]
If you don't want the expressions expanded before they are passed to tr, wrap the whole lot in single quotes, each individual token in double quotes or do away with the square brackets (because a-z is not a file expression whereas [a-z] is!)
tr '[a-z] [A-Z]'
tr "[a-z]" "[A-Z]"
tr a-z A-Z
I'm sure there are situations where you might want to use any one of the above methods depending on how 'clever' you're trying to be at the time.
HTH