![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reading file and assigning that to Variable | Vaddadi | Shell Programming and Scripting | 2 | 04-03-2008 02:49 PM |
| reading a line into a variable in unix | lmadhuri | UNIX for Dummies Questions & Answers | 1 | 02-07-2007 10:04 AM |
| perl - file reading - last line not displayed | matrixmadhan | UNIX for Dummies Questions & Answers | 8 | 12-18-2006 02:10 PM |
| Perl Reading from File | karyn1617 | Shell Programming and Scripting | 1 | 02-17-2005 08:44 PM |
| Reading input to create a variable in a script? | darthur | UNIX for Dummies Questions & Answers | 7 | 12-14-2001 01:12 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
perl not reading my variable
I'm trying to make changes in a file using the following bash script:
Code:
#!/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 So I guess my question is am I not allowed to use variables in the above perl command? TIA, Jennifer |
|
||||
|
I'm not sure what you are trying to do, things seem out of place - but
Code:
perl -pi -e "s/sacuser1/$IAM/ if m/$var/" $README Plus ~ is translated to $HOME - try that instead of the MYHOME thing. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|