Closed naturalblaze closed 2 years ago
Hi! I think this is the right place to ask for help.
For easier debug your problem, can you provide us some more info?
echo $SHELL
bash --version
or echo $BASH_VERSION
Which shell are you using? you can get this with the command echo $SHELL @.*** ~]$ echo $SHELL /bin/bash
Your shell probably be /bin/bash. So which version are you using? bash --version or echo $BASH_VERSION @.*** ~]$ bash --version GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-gnu)
What command sequence are you trying exactly: git clone https://github.com/mrbaseman/parse_yaml.git cd parse_yaml/src/ chmod 775 parse_yaml.sh Then I have tried: ./parse_yaml.sh sample.yml & source parse_yaml.sh eval $(./parse_yaml.sh sample.yml)
Thanks, Blaze
On Thu, Aug 19, 2021 at 11:23 PM Josemar Muller Lohn < @.***> wrote:
Hi! I think this is the right place to ask for help.
For easier debug your problem, can you provide us some more info?
- Which shell are you using? you can get this with the command echo $SHELL
- Your shell probably be /bin/bash. So which version are you using? bash --version or echo $BASH_VERSION
- What command sequence are you trying exactly.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mrbaseman/parse_yaml/issues/10#issuecomment-902401402, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGYLTZ7ZJR4NU4SW4X4QYRLT5XDE5ANCNFSM5CPCCFSQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .
Thanks for your reply!
The problem is:
./parse_yaml.sh sample.yml
parse_yaml.sh wasn't made to be called direct from command line (I'm working in adding this function, and soon I'll make a PR and hope that @mrbaseman approves. But now it really doesn't work this way.).
source parse_yaml.sh eval $(./parse_yaml.sh sample.yml)
This is almost the right way to use it now. The first command source
loads the parse_yaml
(note the absence of .sh
ending) function in your shell. After that, you can access the command parse_yaml
in as a built-in command like ls
or cd
. You can read more about the source command here: https://linuxize.com/post/bash-source-command/
In the second line you are making an eval
(evaluation) of the command execution. Which means, you will execute the output of the parse_yaml
as a new script. This way you can read all the variables of the YAML file and load them in memory. This eval
command doesn't have an output.
Anyway, the second command should be eval $(parse_yaml sample.yml)
(without the ./
and the ending .sh
because you aren't calling the script anymore but the loaded function - yes, I know the names are confusing).
And if you really need an output to see if things are running before load the variables, or can just call parse_yaml sample.yml
(without the eval
).
Don't forget that you have to run the source
command every time you start the shell (open a new one or login again)
Sorry if the answer is confusing. You can ask again if you still have questions.
right, it's explained in the README.md
I apologize if this is the wrong place for this. I cloned the repo and was just trying to use the sample sample.yml but I'm not getting any output when I run parse_yaml.sh. I am running CentOS Linux release 8.4.2105. Are there any package dependencies or anything special I need to do? Thanks!