-1

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?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255

2 Answers2

7

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.

Kusalananda
  • 333,661
3

You need to protect the \ from being interpreted by the shell. Try this:

echo -e '\a'

or

echo -e \\a
kartik_subbarao
  • 451
  • 2
  • 8