[clug] Bash questions...

steve jenkin sjenkin at canb.auug.org.au
Sun May 1 21:54:43 MDT 2011


Thanks for the suggestion.
I love your advice: "reality is wrong" :=]

Seems inbuilt echo is called and doesn't honour the doco and expand
specifically '\e'  :-(

[remember that this bash is OS/X, not a real GNU/Linux :-(]

steve$ type echo
echo is a shell builtin

steve$ echo -en '\a\b\e\f\n\r\t\v\012' |od -cb
0000000   \a  \b   \   e  \f  \n  \r  \t  \v  \n
          007 010 134 145 014 012 015 011 013 012


steve$ which echo
/bin/echo

steve$ /bin/echo -en '\a\b\e\f\n\r\t\v\012' |od -cb
0000000    -   e   n       \   a   \   b   \   e   \   f   \   n   \   r
          055 145 156 040 134 141 134 142 134 145 134 146 134 156 134 162
0000020    \   t   \   v   \   0   1   2  \n
          134 164 134 166 134 060 061 062 012

>From man page (GNU Bash-3.2, 2006 September 28)
              \a     alert (bell)
              \b     backspace
              \c     suppress trailing newline
              \e     an escape character
              \f     form feed
              \n     new line
              \r     carriage return
              \t     horizontal tab
              \v     vertical tab
              \\     backslash
              \0nnn  octal char

steve$ bash --version
GNU bash, version 3.2.48(1)


Alex Satrapa wrote on 2/05/11 12:21 PM:
> On 02/05/2011, at 11:53 , steve jenkin wrote:
> 
>> Tho' it does show up a fault in OS/X bash (echo -e & shopt) - the doco
>> doesn't match Real Life.
> 
> When you type "which echo", does it tell you "echo: shell built-in command" or /bin/echo?
> 
> The manual page refers to /bin/echo. The ZSH documentation includes reference to the '-e' flag to enable escape sequences, overriding any system-wide configuration that may be in place.
> 
> And remember: any time real life doesn't match your expectations, it's not real life that is wrong :)
> 
> Alex
> 


-- 
Steve Jenkin, Info Tech, Systems and Design Specialist.
0412 786 915 (+61 412 786 915)
PO Box 48, Kippax ACT 2615, AUSTRALIA

sjenkin at canb.auug.org.au http://members.tip.net.au/~sjenkin


More information about the linux mailing list