problem using bash variables with command-line perl in bash script

2003-11-27 Thread Marcus Claesson
Hi! I have a problem with variables when using command-line perl in a bash script. The script should update a date (in 2003-10-10 form) if the argument, which is a file name, exists on the same line in the file updated_files.txt. #!/bin/bash FILENAME=$1 UPDATED=`date +%F` echo echo "perl -wne 'i

Re: problem using bash variables with command-line perl in bash script

2003-11-27 Thread drieux
On Thursday, Nov 27, 2003, at 10:04 US/Pacific, Marcus Claesson wrote: Hi! I have a problem with variables when using command-line perl in a bash script. The script should update a date (in 2003-10-10 form) if the argument, which is a file name, exists on the same line in the file updated_files.t

Re: problem using bash variables with command-line perl in bash script

2003-11-27 Thread John W. Krahn
Marcus Claesson wrote: > > Hi! Hello, > I have a problem with variables when using command-line perl in a bash > script. The script should update a date (in 2003-10-10 form) if the > argument, which is a file name, exists on the same line in the file > updated_files.txt. > > #!/bin/bash > FILEN

Re: problem using bash variables with command-line perl in bash script

2003-11-28 Thread Marcus Claesson
Thanks for all your answers! I settled for the simplest of them all, by single quoting the shell variables: > perl -wne 'if (/'$FILENAME'/) { s/\d{4}-\d{2}-\d{2}/'$UPDATED'/;print; > }' updated_files.txt The reason I use bash here and not only good old perl is that the bash script is much bigger

Re: problem using bash variables with command-line perl in bash script

2003-11-28 Thread John W. Krahn
Marcus Claesson wrote: > > I settled for the simplest of them all, by single quoting the shell > variables: > > > perl -wne 'if (/'$FILENAME'/) { s/\d{4}-\d{2}-\d{2}/'$UPDATED'/;print; > > }' updated_files.txt Actually, you are single quoting the perl program. The shell variables are outside th