BlueM/Pashua

Support for zsh

Closed this issue · 2 comments

Ran into this issue while building out a workflow using Pashua in a zsh script (the default in macOS Catalina). Normally I would just switch over to either bash or sh but I am specifically using zsh for associative arrays.

When running in bash/sh I have no issue. When I run zsh I get the following:

(eval):3: command not found: txfUserName
(eval):5: command not found: txfAssetTag
(eval):6: command not found: popBuilding

Which occurs for every element variable I try to return.

Any suggestions?

This is how my config is configured:

txfAssetTag.type = textfield
txfAssetTag.label = Asset Tag
txfAssetTag.default = " "
txfAssetTag.width = "$confWidth"
txfAssetTag.x = 180
txfAssetTag.y = 150

popBuilding.type = popup
popBuilding.label = Building
popBuilding.option = $PashuaBuildingNames
popBuilding.width = "$confWidth"
popBuilding.mandatory = 0
popBuilding.x = 180
popBuilding.y = 100

I have narrowed my issue down to this section of the bash example. It seems that zsh doesn't like the eval command here.

# Parse result
for line in $result
    do
        local name=$(echo $line | sed 's/^\([^=]*\)=.*$/\1/')
        local value=$(echo $line | sed 's/^[^=]*=\(.*\)$/\1/')
        eval $name='$value'
    done

I'll update if I can figure it out. So far, no luck.

Figured it out. I had to change how the result was expanded. Changed $result to ${=result}

for line in ${=result}
    do  
        local name=$(echo $line | sed 's/^\([^=]*\)=.*$/\1/')
        local value=$(echo $line | sed 's/^[^=]*=\(.*\)$/\1/')
        eval $name='$value'
    done