0

I'm trying to build my fstab during install with a script, so I want to have something like this:

printf '# Device\t\tMountpoint\tFSType\tOptions\t\tDump\tPass#' >> /mnt/etc/fstab
printf '\n/dev/ada0p4.elia\t/\t\tufs\trw\t\t1\t2' >> /mnt/etc/fstab
printf '\n/dev/ada0p3.eli\t\tnone\t\tswap\tsw\t\t0\t0' >> /mnt/etc/fstab
printf '\n/dev/ada0p2\t\t/unencrypted\tufs\tro\t\t1\t1' >> /mnt/etc/fstab

Is there a way to do this in csh with echo?

I have tried and it's not working properly. For example, here is a test and the output on my FreeBSD 9.0-RELEASE-p1 box:

# echo test\ttest > test
# cat test
testttest

What is going wrong here?

Utkonos
  • 332
  • 3
  • 12
  • I am suggesting to rewrite your script in sh. http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/ – arved May 10 '12 at 08:01

1 Answers1

1

Csh's builtin echo doesn't support this feature, so you'll need to type the path to the system's echo command. Additionally, you need to either add an additional backslash or put the backslash in quotes.

Either of these should work.

/usr/bin/echo test\\ttest > test

or

/usr/bin/echo 'test\ttest' > test

Contrary to what I posted before, you do not need to use the -e flag. That is only needed for GNU's echo command.

Nicholas
  • 161
  • 4