I have a file on a remote filesystem that I know has a short text string in it (a sequence of numbers in a single line). If I open the file on a text editor like nano or Emacs I can see the string. Also, not sure if this is relevant, but ls reports the file has 8 bytes*.
The odd thing is that if I cat this file, cat reports nothing.
However, I noticed that if I add a linebreak at the end of the line, cat then shows the contents, which is confusing me.
So my questions are:
- Why does this happen? Do I really need a linebreak at the end of each line to have
catprint its contents? Is this the default behavior forcat? (if so, what is the reasoning behind it?) - Is there a way to force
catto print everything in a file, regardless of whether or not I have linebreaks?
Update:
Based on the answers below, I thought it would be relevant to post how I defined my prompt. I'm on zsh, and I have the following two lines on my ~/.zshrc:
export PS1="%{$fg[white]%}%n%{$reset_color%} @ %{$fg[green]%}%m: %{$fg[yellow]%}%~ %{$reset_color%}%%
> "
Before the definition of my prompt, I have the following two lines which I believe enable me to use color aliases in the shell:
autoload -U colors
colors
Rephrasing the question:
With the above in mind, how can I get a linebreak in my prompt, and still manage to get cat to print a file like the above correctly?
*If I touch a random file, ls reports the file has only 0 bytes, so I presume that the fact that ls reports that my file has 8 bytes is meaningful. Not sure if this is helpful though.