csh and echo syntax

Alex Zbyslaw xfb52 at dial.pipex.com
Fri Jun 15 10:43:03 UTC 2007


Olivier Regnier wrote:

> I'm running FreeBSD 6.2 and i use for the moment csh. When i test this 
> command in console
> echo -ne "/dev/da0s1\t /mnt/usb\t msdos\t rw,noauto\t 0\t 0" >> 
> /etc/fstab
>
> and with a cat /etc/fstab,
> i have this : -ne /dev/da0s1\t /mnt/usb\t msdos\t rw,noauto\t 0\t 0
>
> The \t is not supported with a echo in csh ? What happened ?

I'm not sure that any echo has ever supported special escape chars.  
Maybe it's some Gnu/Linuxism?  /bin/echo does the same as csh echo and 
the man page mentions no -e flag.

Try printf.

printf %b "/dev/da0s1\t /mnt/usb\t msdos\t rw,noauto\t 0\t 0"

Why aren't you adding a newline?  Do your command twice and you have a 
broken fstab :-(

printf %b "/dev/da0s1\t /mnt/usb\t msdos\t rw,noauto\t 0\t 0\n"

would, imho, be the right incantation.

--Alex



More information about the freebsd-questions mailing list