Hacking terminal messages

This is a strange question, but I want to know how to change the message arriving at the terminal. For eg-

vikram@vikram-Studio-XPS-1645 :~$ cat seg.c #include<stdio.h> void main() { int* p=9; printf("%x",*p); } vikram@vikram-Studio-XPS-1645 :~$ ./a.out Segmentation fault 

I want to change the message "Segmentation Error" to something else, for example, "Pointer Error".

There is no specific purpose for this, I just want to study the power of open source.

I am trying to grep in the source code of the Linux kernel -

 vikram@vikram-Studio-XPS-1645 :~$ cd linux-3.0.1/ vikram@vikram-Studio-XPS-1645 :~/linux-3.0.1$ grep -r "Segmentation fault" * Documentation/s390/Debugging390.txt:Program terminated with signal 11, Segmentation fault. Documentation/virtual/uml/UserModeLinux-HOWTO.txt: Program received signal SIGSEGV, Segmentation fault. vikram@vikram-Studio-XPS-1645 :~/linux-3.0.1$ 

As the massage arrives, it should be somewhere in my system.

I think I was looking for the wrong place. Thanks in advance.

+4
source share
1 answer

As Mat commented, the message comes from your shell.

Since your shell is probably free (probably bash , but you can also use some others, I like zsh ), you can spend time fixing it.

But I believe that you should not do this, because otherwise you cannot explain what your system does. For example, if your modified shell displays " Pointer failure ", no one will understand the question here that mentions this.

It seems much easier to learn the usual things on Linux ...

+2
source

Source: https://habr.com/ru/post/1398490/


All Articles