Calling Shell Script function from a perl script
There was a related post regarding this issue.

My code in Perl script to call the shell script with functions ..

    `. shellScript.sh $var1 $var2 $var3 $var4; shellFunc1 $var5 $var6`

But the problem I am facing is there is an dynamic variable resides in shellScript.sh

Here is a high level coding of shellScript.sh

    happy=${var1}hello
    holiday=${var2}bye
    
    function shellFunc1 {
       
             cap1=$1
             cap2=$2
    
    if [[ "$cap1" == "happy" ]] || [[ "$cap2" == "holiday" ]]
    then
        echo ${!happy}
        echo ${!holiday}
    fi

Error

    sh: ${!happy}: 0403-011 The specified substitution is not valid for this command.
    sh: "${!holiday}": 0403-011 The specified substitution is not valid for this command.

This is not the real code. Just an example. It was working fine when I am calling this from another shell script. But not working when calling from a Perl script.The dynamic varible creating problem. I would like to know is it possible or do I have to change my code completely.(Before changing the code I wanted to confirm from the Perl Gurus)

If possible can anybody please help me on the same.
     



Calling Shell Script function from a perl script
===

There was a related post regarding this issue.

My code in Perl script to call the shell script with functions ..

    `. shellScript.sh $var1 $var2 $var3 $var4; shellFunc1 $var5 $var6`

But the problem I am facing is there is an dynamic variable resides in shellScript.sh

Here is a high level coding of shellScript.sh

    happy=${var1}hello
    holiday=${var2}bye
    
    function shellFunc1 {
       
             cap1=$1
             cap2=$2
    
    if [[ "$cap1" == "happy" ]] || [[ "$cap2" == "holiday" ]]
    then
        echo ${!happy}
        echo ${!holiday}
    fi

Error

    sh: ${!happy}: 0403-011 The specified substitution is not valid for this command.
    sh: "${!holiday}": 0403-011 The specified substitution is not valid for this command.

This is not the real code. Just an example. It was working fine when I am calling this from another shell script. But not working when calling from a Perl script.The dynamic varible creating problem. I would like to know is it possible or do I have to change my code completely.(Before changing the code I wanted to confirm from the Perl Gurus)

If possible can anybody please help me on the same.
     


