viscroad
viscroad

Reputation: 225

add "&" before redirect command

now, I have a script using redirect command.

set filename1='/home/1.log'

echo "hello " >>& ${filename1}

Question:

  1. I know "&" is added before file handler, but here, "filename1" is a file name, is it necessary to add "&" before this variable?
  2. If not, does this "&" operator have some other meaning?

Many thanks!

Upvotes: 1

Views: 119

Answers (1)

tripleee
tripleee

Reputation: 189497

In the C shell, >& and >>& redirect both standard output and standard error to the designated file.

Note that Csh and derivatives are incompatible with Bourne shell; you should probably consider switching to a standard shell. These days, Bash and Zsh by and large support the same features as Tcsh, without sacrificing syntactic backwards compatibility with Bourne shell. See also http://www.perl.com/doc/FMTEYEWTK/versus/csh.whynot

Upvotes: 3

Related Questions