Syntax check of bash build in commands arguments

Viewed 43

I have a list of logs from bash command line and I need to validate their syntax.

From my investigation I know that bash -n option or tools like https://www.shellcheck.net/ are not sufficient because they do not recognize if executable for command exist or not.

Commands like command, hash or type, which could validate if command exist, but what I missed is how to check if their arguments are valid. (eg. I need to know that ls -l is valid and ls -nonexistingargs is not valid).

Any ideas how to do this? (solution for only build in bash commands is enough).

0 Answers
Related