I want to join an array of strings on the string "%2C+". My shell script launch looks like this.
#!/bin/bash
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
selectQuery=$(join_by "%2C+" $1)
echo selectQuery
But when I run ./download-data $("state_code" "county_code"), I get this error in the terminal: bash: state_code: command not found.
I need to pass the argument as an array since I plan to pass more arrays later on. Something like ./download-data $("state_code" "county_code") $("more" "string").