The echo command doesn't want to interpret backlash escapes (with -e option attached). For example, I want it to ring a bell with:
echo -e \a
Nothing happens, except it prints:
a
or
\a
How to turn on interpreting or how to fix it?
The echo command doesn't want to interpret backlash escapes (with -e option attached). For example, I want it to ring a bell with:
echo -e \a
Nothing happens, except it prints:
a
or
\a
How to turn on interpreting or how to fix it?
In echo -e \a the \ in front of the a will be stripped off from the argument to echo by the shell before echo is called. It is exactly equivalent to
echo -e 'a'
For echo to receive \a as backslash-followed-by-a, the \ has to be passed as is to echo. This is done either through
echo -e '\a'
or
echo -e \\a
If this will actually produce an audible or visible bell may depend on other settings.
~/.inputrc is to configure readline, it doesn't affect the terminal behaviour when you send a BEL character to it.
– Stéphane Chazelas
Feb 20 '18 at 19:50
tmux? But readline would at least control the shell's bells?
– Kusalananda
Feb 20 '18 at 20:29
bell-style would control whether readline sends a \a (BEL) or a visual bell escape sequence or nothing to the terminal when it wants to notify the user.
– Stéphane Chazelas
Feb 20 '18 at 22:55
You need to protect the \ from being interpreted by the shell. Try this:
echo -e '\a'
or
echo -e \\a