I write bash cat << 'EOF' > script to create files.script as below:
#!/bin/bash for sitename in (site1,site2,site3) do cat << 'EOF' >/home/$sitename/conf DEPLOY_DIR="/var/www/$sitename" git --work-tree="DEPLOY_DIR" EOF done The result after run this script should like:
[root@localhost]cat home/site1/conf DEPLOY_DIR="/var/www/site1" git --work-tree="$DEPLOY_DIR" The key is I need to substitute $sitename in DEPLOY_DIR="/var/www/$sitename" and keep git --work-tree="DEPLOY_DIR" as same.
How to do it?
<< EOF,"$DEPLOY_DIR"will become""forloop looks wrong here -- you wantfor sitename in site1 site2 site3; do