b () {
arg=$1
# more code here
}
updateEnvironmentField () {
linewithoutquotes=`echo $LINE | tr -d '"'`
b "$linewithoutquotes"
}
Here, we call b with the the result of your command substitution as a string. The b function receives the string in the variable arg.
Note that you will want to use printf in place of echo and that you will need to properly quote the $LINE expansion so that whitespaces and globbing characters etc. are not messing up your data (I'm also changing the backticks to $(...) since that's more well behaved):
updateEnvironmentField () {
linewithoutquotes=$( printf '%s\n' "$LINE" | tr -d '"' )
b "$linewithoutquotes"
}
If you're using the bash shell, you may use its ${variable//pattern} parameter substitution to delete double quotes,
updateEnvironmentField () {
linewithoutquotes=${LINE//\"}
b "$linewithoutquotes"
}
or just
updateEnvironmentField () {
b "${LINE//\"}"
}
Related:
$linewithoutquotesinsideb()?b()will be invoked in a subshell and its environment will differ from others. – Tuyen Pham Jan 15 '19 at 02:43