Can I use shell script to read a file, find a variable in that file and store it to use in another script?

Viewed 36

I'd like to read a yaml file and find a specific variable, then store that variable's value.

So it's something like:

- variable1:
  variable2:
    - "value"
  variable3:
  - ...

and I want to grab variable2's value, which also happens to be a file path. I'd like to be taken to that file path as well, so using the value to locate the value at that file path. Is that possible in shell script without a 3rd party library/plugin?

If not, what's the best approach to act on a yaml config with this objective?

Any help would be highly appreciated. Cheers!

1 Answers
Related