GNU bug report logs - #19654
tr command odd behavior on Linux Platform

Previous Next

Package: coreutils;

Reported by: Kousik Mandal <kousikmandal <at> gmail.com>

Date: Thu, 22 Jan 2015 17:28:02 UTC

Severity: normal

Tags: notabug

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kousik Mandal <kousikmandal <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: tr command odd behavior on Linux Platform
Date: Thu, 22 Jan 2015 15:22:42 +0530
[Message part 1 (text/plain, inline)]
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
[Message part 2 (text/html, inline)]

This bug report was last modified 10 years and 123 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.