LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bash syntax to have unrecognized command on terminal kept managed (https://www.linuxquestions.org/questions/programming-9/bash-syntax-to-have-unrecognized-command-on-terminal-kept-managed-4175714957/)

BudiKusasi 07-22-2022 06:21 PM

Bash syntax to have unrecognized command on terminal kept managed
 
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

teckk 07-22-2022 07:30 PM

Code:

man script
https://www.man7.org/linux/man-pages/man1/script.1.html

grail 07-23-2022 02:11 AM

The idea here is that you make an attempt to solve it and we assist when you get stuck. ie. not do the work for you

NevemTeve 07-23-2022 02:28 AM

Also it would be nice to know what problem X is in this XY problem.

MadeInGermany 07-23-2022 02:54 AM

You can write your own
command_not_found_handle
function.
https://superuser.com/questions/7874...dler-in-ubuntu


All times are GMT -5. The time now is 06:24 PM.