How is Bash simple one line syntax to check and get the invalid or unrecognized command fed in shell or terminal prompt to be saved in a file? Illustration e.g.
Code:
$ run_bash_command FILE
$ foo
bash: foo: command not found
$ bar
bash: bar: command not found
$ baz
bash: baz: command not found
$ cat FILE
foo
bar
baz
So help solve it please. Thanks much in advance