Let's take example. There are 2 scripts,
- main.sh
- invoke.sh
I want to execute invoke.sh script from main.sh. When the script invoke.sh executes from main.sh, invoke.sh produces below output on Linux terminal,
jbhaijy@ubuntu:~$./main.sh
Resources available on this system:
CPU TYPE: x86_64
Num cores: 4
Total RAM: 15979 MB
Avail RAM: 13299 MB
Total disk: 343 GB
Avail disk: 60 GB
GPU Type: None
State: unregistered
I want to check specific string i.e. State: registered or State: unregistered from the above(invoke.sh) output & returned State to main.sh. Based on the State string, main.sh will inform the user that device is registered or unregistered.
Questions:
- How we can check particular State string i.e. "registered" or "unregistered"?
- How we can returned State string to main.sh?
Hope my question gives enough clarity to you.