bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why doesn't "cat" print content of a file to standard output if the cont


From: vatbier
Subject: Why doesn't "cat" print content of a file to standard output if the content is only a number ?
Date: Fri, 12 Sep 2003 20:49:53 +0200

ML9.1 here.
When I type in a Konsole
 "cat /var/lock/subsys/dm"
no output is generated (dm containing the pid number of process prefdm)
to the Konsole.
But when I type
 "kill `cat /var/lock/subsys/dm"
the process is effectively killed.

I found this command in /etc/rc.d/init.d/dm:
" stop)
        gprintf "Stopping display manager: "
        if [ -r /var/lock/subsys/dm ]; then
            kill `cat /var/lock/subsys/dm` > /dev/null 2>&1
"

It took me a while to figure out that "cat" wouldn't print the content
of a file to the Konsole(standard output) if that content consist only
of a number. If that number is followed by a space in that file "cat"
shows "number " on the Konsole.
But if I type "cat /var/lock/subsys/dm > test.txt" the number is
copied to test.txt. And in the command "kill `cat /var/lock/subsys/dm"
the number is correctly presented to the "kill" command.

Why this behaviour for "cat" ? "info cat" gives me no clue.
Is this a bug of "cat" or some sort of feature ?

vatbier




reply via email to

[Prev in Thread] Current Thread [Next in Thread]