Bash pass parameters into a command from variables
by dazzpowder from LinuxQuestions.org on (#5A8QQ)
Hi I have a command i would like to run that will require two parameters the directory of a keystore and the default label of a certificate. I can get the name of the directory easily enough and the default label of a certificate.
I have these stored as
dir=$(find ./*/ssl -type f -name *.kdb)
above will give me the path of the keystore db file
e.g output
a/ssl/file.kdb
b/ssl/file.kdb
then I have the labels stored as
label=for i in ls -ld */ssl; do runmqakm -cert -list all -db $i/*.kdb -stashed | grep -e 'nameoflabel*'| cut -f2;done
e.g output labela labelb labelc
but I need to add the corresponding directory from $dir and label from $label into a single command e.g
aCommndToRun -db $dir -label $label | grep -ie "not" -ie "cn"
Can anyone shed some light as to how I can format the variables in a way that can be used as positional parameters?
Thanks


I have these stored as
dir=$(find ./*/ssl -type f -name *.kdb)
above will give me the path of the keystore db file
e.g output
a/ssl/file.kdb
b/ssl/file.kdb
then I have the labels stored as
label=for i in ls -ld */ssl; do runmqakm -cert -list all -db $i/*.kdb -stashed | grep -e 'nameoflabel*'| cut -f2;done
e.g output labela labelb labelc
but I need to add the corresponding directory from $dir and label from $label into a single command e.g
aCommndToRun -db $dir -label $label | grep -ie "not" -ie "cn"
Can anyone shed some light as to how I can format the variables in a way that can be used as positional parameters?
Thanks