Search code examples
shellcygwin

Error while using shell script to copy lines to a file using cygwin


I am trying to copy few lines to another file .bashrc using shell script and cygwin terminal.The lines are :

echo "export DEVENVHOME=${DEVENVHOME:-$workarea/devenv.x}" >> .bashrc

I am writing command :

 workarea="/home/WORKAREA" sh script1.sh

But the output on .bashrc is :

  export DEVENVHOME=workarea/devenv.x

But i want the copy line

   export DEVENVHOME=${DEVENVHOME:-$workarea/devenv.x}

in .bashrc where $workarea should be replaced by the workarea provided as argument on cygwin terminal.


Solution

  • Single quotes suppress substitution.

    echo '...' >> ...