Bat: File content not printed

Created on 5 Mar 2019  路  3Comments  路  Source: sharkdp/bat

Context
When calling the bat command with a file as an argument, nothing is printed as output instead of printing the file content.
But, when specifying the same file two times as arguments, the file content is correctly printed two times.

Example
When calling $bat readme.md the command terminates immediately without printing any content.
When calling $bat readme.md readme.md the content of the file readme.md is printed two times as attended.

Environnement
System: Ubuntu 18.04.1 LTS 64-bit
Bat: Version 0.10.0
Shell: GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)

Reproducibility
Number of attempts: 10 (10 files with different extensions)
Percentage: 100%

-> _Tested from cargo install from Github repository source as well as dpkg install._

question

Most helpful comment

I'm closing the issue, added the -X option to less resolved this issue as referenced in the bat Using a different pager information section.

All 3 comments

Thank you for reporting this.

I suspect that this might be related to the pager you are using. Could you please show the output of this bash snippet:

echo -n "bat version: "
bat --version

echo -n "config file: "
bat --config-file

bat "$(bat --config-file)"

echo "BAT_PAGER = '$BAT_PAGER'"
echo "BAT_CONFIG_PATH = '$BAT_CONFIG_PATH'"
echo "BAT_STYLE = '$BAT_STYLE'"
echo "BAT_THEME = '$BAT_THEME'"
echo "BAT_TABS = '$BAT_TABS'"
echo "PAGER = '$PAGER'"

and possibly try to run bat with --paging=never?

Indeed it seems directly related to the pager used, here is the output:

bat version: bat 0.10.0
config file: /home/ya/.config/bat/config
[bat error]: '/home/ya/.config/bat/config': No such file or directory (os error 2)
BAT_PAGER = 'less -RF'
BAT_CONFIG_PATH = ''
BAT_STYLE = ''
BAT_THEME = ''
BAT_TABS = ''
PAGER = ''

When running bat file --paging=never the content is succesfully printed.

I'm closing the issue, added the -X option to less resolved this issue as referenced in the bat Using a different pager information section.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scalp42 picture scalp42  路  3Comments

samuelcolvin picture samuelcolvin  路  3Comments

issmirnov picture issmirnov  路  3Comments

mjlbach picture mjlbach  路  3Comments

rien333 picture rien333  路  3Comments