![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| returning to the parent shell after invoking a script within a script | gurukottur | Shell Programming and Scripting | 5 | 09-26-2006 08:05 AM |
| Invoking Shell Script via php | bubeshj | Shell Programming and Scripting | 2 | 06-30-2006 07:09 AM |
| Invoking shell script from html/jsp page | bubeshj | Shell Programming and Scripting | 2 | 06-28-2006 02:53 PM |
| invoking one shell script from other | ajay xavier | Shell Programming and Scripting | 3 | 05-24-2006 04:39 AM |
| Wrong Shell Invoking My Script On Linux | kowrip | Shell Programming and Scripting | 3 | 09-10-2003 11:18 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Invoking shell script with perl command.
Hi All, I am using the following command to invoke the shell script from a perl command. Code:
perl -i.bak -pe'BEGIN { $cmd = "/opt/coreservices/tomcat-5.5.9/bin/digest.sh -a sha"; }
s/(password=")([^"]*)/
$1.`$cmd $2|cut -d: -f2|tr -d "\n"`
/e
' $CATALINA_HOME/conf/tomcat-users.xml
I need to put in $CATALINA_HOME where I have /opt/coreservices/tomcat-5.5.9 , so the statement should be something like Code:
perl -i.bak -pe'BEGIN { $cmd = "$CATALINA_HOME/bin/digest.sh -a sha"; }
s/(password=")([^"]*)/
$1.`$cmd $2|cut -d: -f2|tr -d "\n"`
/e
' $CATALINA_HOME/conf/tomcat-users.xml
Now since perl does not understand the shell variables, I did the following, but it is not working. Code:
typeset -x MY_VARIABLE=$CATALINA_HOME
perl -i.bak -pe'BEGIN { $cmd = "$MY_VARIABLE"/bin/digest.sh -a; }
s/(password=")([^"]*)/
$1.`$cmd $2|cut -d: -f2|tr -d "\n"`
/e
' $CATALINA_HOME/conf/tomcat-users.xml
Can anyone please help! |
|
||||
|
Hi ! You can get environment variable by through %ENV hash. In your case: Code:
perl -i.bak -pe'BEGIN { $cmd = $ENV{CATALINA_HOME}/bin/digest.sh -a; }
s/(password=")([^"]*)/
$1.`$cmd $2|cut -d: -f2|tr -d "\n"`
/e
' $CATALINA_HOME/conf/tomcat-users.xml
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|