LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-22-2022, 06:21 PM   #1
BudiKusasi
Member
 
Registered: Apr 2017
Distribution: Artix
Posts: 345

Rep: Reputation: 15
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
 
Old 07-22-2022, 07:30 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,141
Blog Entries: 6

Rep: Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828
Code:
man script
https://www.man7.org/linux/man-pages/man1/script.1.html
 
Old 07-23-2022, 02:11 AM   #3
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,008

Rep: Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193Reputation: 3193
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
 
1 members found this post helpful.
Old 07-23-2022, 02:28 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,869
Blog Entries: 1

Rep: Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870Reputation: 1870
Also it would be nice to know what problem X is in this XY problem.
 
Old 07-23-2022, 02:54 AM   #5
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,806

Rep: Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206Reputation: 1206
You can write your own
command_not_found_handle
function.
https://superuser.com/questions/7874...dler-in-ubuntu
 
2 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Vmnet adapters are shown as "device not managed". There are two adapters vmnet1 and vmnet8 which are all not managed. kats99 Linux - Networking 4 11-01-2019 01:42 AM
apt-get upgrade packages have been kept back cccc Debian 7 04-11-2007 02:35 PM
xf86config is an unrecognized bash command in fresh install of slackware 10 drxsmurf Slackware 2 07-07-2004 11:49 PM
what does "The following packages have been kept back" mean joesbox Debian 2 10-26-2003 04:35 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration