Multiline variable in tcsh

I want to have a variable in tcsh to store usage information for my script, so in my script, whenever I write echo $ usage, it prints

my_script
  -h : -help
  -b : do boo

etc`.

Is there any way to do this? Can this be done using <EOF?

I tried something like this, but this failed:

set help =  << EOF
     my_script 
       -h : print help
       -b : do boo
EOF

thank

+5
source share
2 answers
set help = 'my_script\
  -h : -help\
  -b : do boo'

echo $help:q

Another approach:

alias help 'echo "my_script" ; echo "  -h : -help" ; echo "  -b : do boo"'

help

But see also: http://www.faqs.org/faqs/unix-faq/shell/csh-whynot/

csh tcsh , , , . , echo "$help" ; , , , .

( Bourne :

help() {
    cat <<EOF
my_script
  -h : -help
  -b : do boo
EOF
}

help

csh tcsh .)

+8

'' , , . , :

#!/bin/tcsh

set help =      "my_script   \n" 
set help = "$help  -h : -help\n"
set help = "$help  -b : do boo"

echo $help:q
0

All Articles