Sample Header Ad - 728x90

More / file reporting "not a text file" file which contains only one letter and newline

2 votes
1 answer
704 views
I am confused by the output of the more program under linux. When creating a file which contains only a single letter (except for special letters like ä which work fine), more does not report the file's content, but that the file is not a text file. As soon as the file contains more than one letter, more does not report an error, but simply prints the file's output.
> rm file
> echo 'h' > file
> more file
 
******** file: Not a text file ********
 
> cat file
h
Is this a bug in my version of more or do specific requirements to text files exist, that are not fulfilled in my one-letter file example? more version: more from util-linux 2.36.2. ## Further details **Content of the file** The output of od is as follows:
> od -x file
0000000 0a68
0000002
From what I understand, the problem does not seem to be only caused by echo behaving differently from the way I expected, because when I use printf as it follows, the problem persists and the output of the od command is the same (so the files produced via echo and printf should be the same)
> printf 'h\n' > file2
> more file2
 
******** file2: Not a text file ********

> od -x file2
0000000 0a68
0000002
**Version of file utility**
> file --version
file-5.40
magic file from /usr/share/file/misc/magic
seccomp support included
**System information** My system is arch linux, and echo is the shell build-in command which I utilized via bash and zsh. **Bug report** Thanks to your feedback I was able to report this as a bug at the correct bug tracker: https://bugs.astron.com/view.php?id=256
Asked by mutableVoid (168 rep)
Apr 2, 2021, 05:41 PM
Last activity: Apr 2, 2021, 06:58 PM