Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
I think such Regexp is way too much and would probably lead to future confusion. If you are using some kind of Bash, what about using the fact that the file can be sourced and use its assignations...
Answer
#1: Initial revision
I think such Regexp is way too much and would probably lead to future confusion. If you are using some kind of Bash, what about using the fact that the file can be sourced and use its assignations? So if you have a file with this content: ``` x1=y2 ``` And you source it (`. file` or `source file`), then you have the variable `$x1` ready for use. With that in mind, we can do: ``` ( source file; [ "$x1" = "y2" ] && [ "$c5" = "d6" ] && echo "yes" || echo "no" ) ``` This sources the file and then checks if the values of vars `$x1` and `$c5` are the ones we want. If so, it prints a plain "yes"; otherwise, a "no".