Code Monkey home page Code Monkey logo

Comments (2)

gromgit avatar gromgit commented on July 17, 2024 1

You've misunderstood bash command line expansion. From the EXPANSION section of the bash man page:

Expansion is performed on the command line after it has been split into words. There are seven kinds of expansion performed: brace expansion, tilde expansion, parameter and variable expansion, command substitution, arithmetic expansion, word splitting, and pathname expansion.

The order of expansions is: brace expansion; tilde expansion, parameter and variable expansion, arithmetic expansion, and command substitution (done in a left-to-right fashion); word splitting; and pathname expansion.

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"
      }
   }
}

from jo.

tom-i avatar tom-i commented on July 17, 2024

Thx a lot.. helped 👍

from jo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.