for loop and sed

Nathan England nathan at paysonlinux.org
Fri Sep 8 07:58:56 MST 2006


> > for user in '/bin/ls /home'; do
>
> are those backticks?
>
> > cp /var/spool/cron/nengland /var/spool/cron/$user
> > sed -i 's/nengland/$user/' $user
>
> sed -i 's/nengland/'$user'/' $user
>
> Single quotes inhibit variable expansion, so you need to get outside the
> quotes :).
>
> Just thought I'd point it out because you can't always used double-quote
> as Kurt suggested.


Yes, they are backticks. I used double quotes and it worked great. Thanks 
guys!


More information about the PLUG-discuss mailing list