A year ago, I didn't even know you can write a C code for Bash extension. Yesterday, I stumbled on Using and Writing Bash Dynamically Loadable Built-In Commands and I knew I could do something with this new discovery.
So, I wrote a C code for replacing my Bash version script. The speed is only three times fast, I am so disappointed I expected much faster. Anyway, it's really hardly can gain much from improving PS1, it's not as if your PS1 is required to update 1000 times per second.
You can go check some loadable builtins comes with Bash, they should be installed at
If you want to develop your own builtin, you will need to download the Bash source code. I doubt any distro will install header files of Bash for you. A basic
So, I wrote a C code for replacing my Bash version script. The speed is only three times fast, I am so disappointed I expected much faster. Anyway, it's really hardly can gain much from improving PS1, it's not as if your PS1 is required to update 1000 times per second.
You can go check some loadable builtins comes with Bash, they should be installed at
/usr/lib[64]/bash/
. Use enable <name>
to enable and to disable with -d
.If you want to develop your own builtin, you will need to download the Bash source code. I doubt any distro will install header files of Bash for you. A basic
./configure
is needed to generate necessary header files and also you will need to run make pathnames.h
for that header at least.
0 comments:
Post a Comment