-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gaps in variable #182
Comments
You've misunderstood bash command line expansion. From the EXPANSION section of the bash man page:
Note that command substitution comes before word splitting. In fact, you left out some errors in your original output, that were a Big Red Flag waving you in this direction: $ vod_id="1611180934340500000"
$ vod_title="…a jitra jsou zde tichá"
$ vod_title_original='The Dawns Here Are Quiet'
$ jo name="$vod_title_original"
{"name":"The Dawns Here Are Quiet"}
$ jo -p -n -- -s id=$vod_id name="$vod_title" meta[alternativeName]=$(jo name="$vod_title_original")
Argument `Dawns' is neither k=v nor k@v
Argument `Here' is neither k=v nor k@v
Argument `Are' is neither k=v nor k@v
Argument `Quiet"}' is neither k=v nor k@v
{
"id": "1611180934340500000",
"name": "…a jitra jsou zde tichá",
"meta": {
"alternativeName": "{\"name\":\"The"
}
} You just need another pair of quotes, to protect your command substitution against word splitting: $ jo -p -n -- -s id=$vod_id name="$vod_title" meta[alternativeName]="$(jo name="$vod_title_original")"
{
"id": "1611180934340500000",
"name": "…a jitra jsou zde tichá",
"meta": {
"alternativeName": {
"name": "The Dawns Here Are Quiet"
}
}
} |
Thx a lot.. helped 👍 |
Hi,
if
vod_title_original
has some gaps (spaces) insidejo
doesn't add whole string with gaps, just first string.result:
Without quotes:
jo -p -n -- -s id=$vod_id name="$vod_title" meta[alternativeName]=$(jo name=$vod_title_original)
Looks like bug for me, or have I misunderstood something? Because basic element
name:
shows gaps without problem.Distro: Archlinux
jo: 1.6
The text was updated successfully, but these errors were encountered: