You are not logged in.

#1 2011-08-11 23:22:57

ShaneLessor
Member
Registered: 2011-08-11
Posts: 4

Rebuilding Bash [SOLVED]

Hi everyone!

I was inspired by a George Carlin book to change the output of something like:

[shane@lessorlabs ~]$ OoggityBoogity
bash: OoggityBoogity: command not found
[shane@lessorlabs ~]$

I want to change the "command not found" to, well, something else. Either way, I downloaded the latest Bash's source code and changed what appear to be the necessary C coding to how I see it fit, however, I'm confused now. Wouldn't I have to remove the current Bash to build this bash, and once I do that won't executing any command be like, impossible?

Thanks in advanced, and I'm more than open to alternate methods.
P.S. I'm kinda new to Arch, so go easy on me if I'm asking something totally outlandish. wink I'm really sorry if I'm posting in the wrong section of the forum.

Last edited by ShaneLessor (2011-08-12 01:26:31)

Offline

#2 2011-08-11 23:33:06

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Rebuilding Bash [SOLVED]

bash isn't the only shell on the planet, you can use e.g. dash :-)

There's a "handle" that does X when command is not found e.g. suggest installing package ABC that provides this command etc. Put this in your .bashrc and you're done:

command_not_found_handle () { echo Nope, try again. ; }

Last edited by karol (2011-08-11 23:35:14)

Offline

#3 2011-08-11 23:51:00

ShaneLessor
Member
Registered: 2011-08-11
Posts: 4

Re: Rebuilding Bash [SOLVED]

This didn't seem to work, but thanks for your help anyway! Probably my own error. tongue

Offline

#4 2011-08-11 23:54:22

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Rebuilding Bash [SOLVED]

ShaneLessor wrote:

This didn't seem to work, but thanks for your help anyway! Probably my own error. tongue

After you put the above line in your .bashrc, you have to source it

. ~/.bashrc

Offline

#5 2011-08-11 23:55:36

ShaneLessor
Member
Registered: 2011-08-11
Posts: 4

Re: Rebuilding Bash [SOLVED]

Sorry, I just had placed it in the wrong part of the file! Thank you very much! It worked! smile

How would I change this for Root? Change ~/.bashrc?

Offline

#6 2011-08-11 23:59:47

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Rebuilding Bash [SOLVED]

ShaneLessor wrote:

How would I change this for Root? Change ~/.bashrc?

You can use e.g. /etc/bash.bashrc.local so it will affect every user, including root, or use /root/.bashrc.

Offline

#7 2011-08-12 00:27:57

ShaneLessor
Member
Registered: 2011-08-11
Posts: 4

Re: Rebuilding Bash [SOLVED]

Thanks a lot! This is exactly what I wanted. smile

Offline

#8 2011-08-12 00:33:25

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Rebuilding Bash [SOLVED]

Glad I could help.

Please mark the thread as solved.

Offline

Board footer

Powered by FluxBB