Skip to content
/ ldnsbash Public

An example of how to create a bash builtin. This one uses ldns to query cloudflare with whoami (returns your public IP address)

License

Notifications You must be signed in to change notification settings

644/ldnsbash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Custom Bash Builtin

The main reason for making a bash builtin would be simply for perfomance. This effectively allows you to have C bindings in bash, so for example, you could create a JSON parser/sorting algorithm in C, compile it as a bash builtin, and write scripts around it, which would allow you to do things that usually you'd use jq for, but much more efficiently.

Install Guide

Oneliner

git clone https://github.com/644/ldnsbash; cd ldnsbash; make; enable -f ./ldnsbash.so ldnsbash; ldnsbash; echo "$LDNSBASH"

Breakdown

Download this repo and cd to it

git clone https://github.com/644/ldnsbash
cd ldnsbash

Build it

make

Load the builtin into bash

enable -f ./ldnsbash.so ldnsbash

And run it

ldnsbash
echo "$LDNSBASH"

To unload the builtin

enable -d ldnsbash

It's important to have bash >4.0+ installed, along with bash-builtins.

License

MIT

About

An example of how to create a bash builtin. This one uses ldns to query cloudflare with whoami (returns your public IP address)

Topics

Resources

License

Stars

Watchers

Forks