Home > Net >  echo -ne "${none}" every other line when using editor for commands
echo -ne "${none}" every other line when using editor for commands

Time:04-02

I've been having an issue with echo -ne "${none}" displaying every other line when issuing commands from the shell editor ctrl-x e

For example entering for i in what is going on ? ; do echo "$i"; done will print out

echo -ne "${none}"
echo -ne "${none}"
what
echo -ne "${none}"
echo -ne "${none}"
is
echo -ne "${none}"
echo -ne "${none}"
going
echo -ne "${none}"
echo -ne "${none}"
on
echo -ne "${none}"
echo -ne "${none}"
R

I'm not really sure what's going on. It doesn't seem to have an effect on things, but makes reading the output kind of a pain.


So I think I've worked out why I am getting the 'echo -ne "${none}"' only from editor.

I have edited my .bashrc do include the fancy bash prompt from https://github.com/andresgongora/synth-shell . do colourise my bash prompt.

        ############################################################################
        ## BASH PROMT                                                             ##
        ## Generate promt and remove format from the rest                         ##
        ############################################################################
        PS1="$TITLEBAR\n${PROMT_USER}${SEPARATOR_1}${PROMT_HOST}${SEPARATOR_2}${PROMT_PWD}${SEPARATOR_3}${PROMT_INPUT}"



        ## For terminal line coloring, leaving the rest standard
        none="$(tput sgr0)"
        trap 'echo -ne "${none}"' DEBUG

I assume that entering commands from the editor doesn't set the none variable

CodePudding user response:

I suggest to inspect your bash non-interactive shell initiation/termination process.

It seems each time a non-interactive shell command is called and terminated you receive echo -ne "${none}"

Suggestion 1

One trick to identify the current bash functions that includes echo -ne :

set |grep -B 20 "echo -ne"

This command will print the 20 lines above each echo -ne command.

Suggestion 2

Inspect bash initiation/termination scripts:

sudo grep "echo -ne " ~/.bash_profile ~/.bash_login ~/.profile /etc/profile /etc/bashrc /etc/profile.d/*

Suggestion 3

Check configuration of your shell prompt PS1, it might be unsupported by your terminal (colors, bolds, fonts,...)

sudo grep PS1 ~/.bash_profile ~/.bash_login ~/.profile /etc/profile /etc/bashrc /etc/profile.d/*

Suggestion 4

Test if this behavior is consistent when you are using text only session (TUI) without GUI.

If this problem appears only in GUI environment you have configuration problem with your terminal TTY configuration and/or prompt PS1 .

  • Related