I'm trying to make changes in a file using the following bash script:
#!/bin/bash
MYHOME=`echo $HOME`
README=$MYHOME"/environment"
IAM=`whoami`
CHANGEPATHLIST="TALOG TACONFIG TAINFO TAWORK TMPSPACE"
for var in $CHANGEPATHLIST
do
perl -pi -e 's/sacuser1/$IAM/ if m/$var/' $README
done
The problem is $var and $IAM are interpreted as null. If I echo the values of these variables, I can see that they are correct.
So I guess my question is am I not allowed to use variables in the above perl command?
TIA,
Jennifer