Skip to main content
grammar tweaks
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 263

There's alota lot of information in the online manual for each command,command; it is always worth having a look at that before giving up and posting a question.

So \x86 is just incorrect. it must be octal and put your string in double quotes, otherwise it will be interpreted by the shell.

Example:

As Ouki reminded me, echo is also a shell buitinbuiltin, so the information is in the manual page for bash, man bash,; here's the relevant section. But Use Quotesuse quotes " around your string to stop the shell interpreting the back slashes.

There's alot of information in the online manual for each command, it is always worth having a look at that before giving up and posting a question.

So \x86 is just incorrect. it must be octal and put your string in double quotes otherwise it will be interpreted by the shell.

Example

As Ouki reminded me, echo is also a shell buitin, so the information is in the manual page for bash, man bash, here's the relevant section. But Use Quotes " around your string to stop the shell interpreting the back slashes.

There's a lot of information in the online manual for each command; it is always worth having a look at that before giving up and posting a question.

So \x86 is just incorrect. it must be octal and put your string in double quotes, otherwise it will be interpreted by the shell.

Example:

As Ouki reminded me, echo is also a shell builtin, so the information is in the manual page for bash, man bash; here's the relevant section. But use quotes " around your string to stop the shell interpreting the back slashes.

Edit 1
Source Link
X Tian
  • 10.7k
  • 3
  • 35
  • 51

Edit 1

As Ouki reminded me, echo is also a shell buitin, so the information is in the manual page for bash, man bash, here's the relevant section. But Use Quotes " around your string to stop the shell interpreting the back slashes.

   echo [-neE] [arg ...]
          Output  the  args, separated by spaces, followed by a newline.  The return status is always
          0.  If -n is specified, the trailing newline is suppressed.  If the  -e  option  is  given,
          interpretation  of  the  following  backslash-escaped characters is enabled.  The -E option
          disables the interpretation of these escape characters, even  on  systems  where  they  are
          interpreted  by  default.   The  xpg_echo shell option may be used to dynamically determine
          whether or not echo expands these escape characters by default.  echo does not interpret --
          to mean the end of options.  echo interprets the following escape sequences:
          \a     alert (bell)
          \b     backspace
          \c     suppress further output
          \e     an escape character
          \f     form feed
          \n     new line
          \r     carriage return
          \t     horizontal tab
          \v     vertical tab
          \\     backslash
          \0nnn  the eight-bit character whose value is the octal value nnn (zero to three octal dig‐
                 its)
          \xHH   the eight-bit character whose value is the hexadecimal value HH (one or two hex dig‐
                 its)

Edit 1

As Ouki reminded me, echo is also a shell buitin, so the information is in the manual page for bash, man bash, here's the relevant section. But Use Quotes " around your string to stop the shell interpreting the back slashes.

   echo [-neE] [arg ...]
          Output  the  args, separated by spaces, followed by a newline.  The return status is always
          0.  If -n is specified, the trailing newline is suppressed.  If the  -e  option  is  given,
          interpretation  of  the  following  backslash-escaped characters is enabled.  The -E option
          disables the interpretation of these escape characters, even  on  systems  where  they  are
          interpreted  by  default.   The  xpg_echo shell option may be used to dynamically determine
          whether or not echo expands these escape characters by default.  echo does not interpret --
          to mean the end of options.  echo interprets the following escape sequences:
          \a     alert (bell)
          \b     backspace
          \c     suppress further output
          \e     an escape character
          \f     form feed
          \n     new line
          \r     carriage return
          \t     horizontal tab
          \v     vertical tab
          \\     backslash
          \0nnn  the eight-bit character whose value is the octal value nnn (zero to three octal dig‐
                 its)
          \xHH   the eight-bit character whose value is the hexadecimal value HH (one or two hex dig‐
                 its)
Source Link
X Tian
  • 10.7k
  • 3
  • 35
  • 51

There's alot of information in the online manual for each command, it is always worth having a look at that before giving up and posting a question.

man echo explains which escape sequences are allowed. Here's an extract.

   If -e is in effect, the following sequences are recognized:

   \0NNN  the character whose ASCII code is NNN (octal)

   \\     backslash

   \a     alert (BEL)

   \b     backspace

   \c     produce no further output

   \f     form feed

   \n     new line

   \r     carriage return

   \t     horizontal tab

   \v     vertical tab

So \x86 is just incorrect. it must be octal and put your string in double quotes otherwise it will be interpreted by the shell.

Example

$ echo -e -n "\033\07\017" >tf
$ od -c tf
0000000 033  \a 017
0000003