Search code examples
shelltcsh

usage of echo in the script


I tried to use a copied script, which includes the following command

echo "rc  $2" > $WORKDIR/out.dat

I can guess it tries to output some contents to file out.dat. But what does "rc $2" mean?

It also includes

echo "PWD" >> $WORKDIR/env.txt

Why it uses >> here instead of >


Solution

  • "rc" means nothing here and neither does "PWD". They are just strings. They presumably mean something in out.dat and env.txt, though. The "$2" is a reference to the second arg used to call the script.

    >> means append to a file rather than overwriting it like > will do.