William Ballard wrote:
> $ grep '\t8' 1
> $ grep "`echo -e '\t'`8" 1
> host  cookie  8       www.execsoft.co.uk
> 
> I could have sworn that shells natively understood \t as tab,
> but apparently the only way to pass one to a shell is with
> `echo -e '\t'`, or `echo -e \\\\t`.

Yes, a common shell question.  Here are the two common ways of
creating ascii tabs on the comand line.  The first is maximally
portable back to very old v7 systems and are preferred by some.  The
second is my preferred method on modern systems.

  TAB=`awk 'BEGIN{printf "\t";}'`
  TAB=$(printf "\t")

As a bash specific feature you can use $'\t' but since that is so bash
specific I hate to use it.

But basically, yes, you have to create a variable first and then use
the variable where you need the tab.  Alternatively you can create
literal tabs but it is whitespace and gets lost easily.

Bob

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to