Hi Team,
I am observing an unexpected behavior with tr command. In a directory if there exist one file named a and executing following tr command.
---script---
myVar="Hello World"
$ echo $myVar|tr [A-Z] [a-z]
---script---
It gives Output: aello aorld
Where as if there exist another file/directory named b then the same command it failing with below error
---script---
myVar="Hello World"
$ echo $myVar|tr [A-Z] [a-z]
---script---
Output:
tr: extra operand `b'
Try `tr --help' for more information.
If only file b is present then the same command is not failing but it give wrong output.
---script---
myVar="Hello World"
$ echo $myVar|tr [A-Z] [a-z]
---script---
Output:
Hello World
Same type of observation found if only a single alphabetic name file or directory is exist.
Can you please update me it is a bug or expected behavior?
Thanks,
Kousik