I'm writing something like the following script. It's doesn't work as expected because the function deleteCEfromCeLst
has to call a script specifying to it a "void" parameter through the spawnPrg
function, but if I specify in the spawnPrg
function parameters the "void" parameter ''
, that I use when I call the script $HOME/execsh/delete.sh
directly from prompt, this "void" parameter results (correctly) as nothing and not as a not specified parameter.
The use of the spawnPrg
function is mandatory because it will be used from other functions called from the "main" flow or directly by the main flow, furthermore the function spawnPrg
shall contain behaviours act to register something like a log file.
#!/bin/bash
spawnPrg()
{
echo $@
$@ &
return
}
deleteCEfromCeLst()
{
local d
cat ce.lst | while read d; do
spawnPrg $HOME/execsh/delete.sh $1 '' $d
done
return
}
deleteCEfromCeLst
exit
I tried also to code deleteCEfromCeLst
as:
deleteCEfromCeLst()
{
local d
cat ce.lst | while read d; do
spawnPrg "$HOME/execsh/delete.sh $1 '' $d"
done
return
}
With the above code the result is that the function spawnPrg is executed as it is sent to the prompt as:
$HOME/execsh/delete.sh $1 \'\' $d
where the "void" parameter is specified as the string ''
that is either that the second parameter sent to the delete.sh
script is not a "void" parameter.