Title: Error while using shell script to copy lines to a file using cygwin
Tags: shell;cygwin
Question: 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}" &gt;&gt; .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.


Here is the accepted answer: Single quotes suppress substitution.

```echo '...' &gt;&gt; ...
```

Comment for this answer: Your `.bashrc` is not interactive with your current shell environment since it is loaded when your session starts, so it won't pick up variables set later.  You would also need to specify the `$workarea` variable in your `.bashrc` as well in order for this to work as intended, or if you do want it to interact with your current shell environment, you would need to use some form of `eval` -- for instance if I want to load my user's .bashrc settings in my root shell, I would use `eval "$(cat /home/username/.bashrc)"`.  Experiment around with `eval` a bit, and you can get what you're looking for.
Comment for this answer: I wrote accordingly, But now the $workarea variable is also not being replaced by argument provided through cygwin terminal.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:11/10/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<shell><cygwin>', 'Title': 'Error while using shell script to copy lines to a file using cygwin', 'ViewCount': 32, 'id': 33629933, 'user_AboutMe': None, 'user_AccountId': 7146957.0, 'user_DisplayName': 'happymind', 'user_Reputation': 3.0, 'user_Views': 1.0, 'user_id': 5462351.0}}