how to reference bash variables inside perl script inside bash script?
Brian Cluff
brian at snaptek.com
Thu Jun 24 14:07:17 MST 2010
On 06/23/2010 09:44 PM, Steven A. DuChene wrote:
> The core part of the script I am having a problem with looks like:
>
> #!/bin/bash
>
> OPASS=$2
>
> PASS=`perl -e 'print("userPassword: {CRYPT}".crypt("$OPASS","frat-salt")."\n");'`
Try changing it to this:
PASS=`perl -e 'print("userPassword:
{CRYPT}".crypt("'$OPASS'","frat-salt")."\n");'`
That change is to add single quotes around the bash variable, the idea
is that you have to turn off the quoting log enough allow bash to be
able to insert a variable and then turn it back on so everything else
will work correctly. It doesn't work in most other languages, but bash
isn't like most other languages :)
Brian Cluff
More information about the PLUG-discuss
mailing list