Skip to content

dse/bash-builtin-path

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

bash-builtin-path

The path GNU Bash builtin makes manipulating PATH and similarly constructed environment variables easier.

It also serves as a real-world example of how to construct a Bash builtin in C.

Usage

To list the contents of a path:

path PATH
path MANPATH

To check if a directory is in your PATH:

path -c PATH /usr/local/bin

To prepend a directory:

path PATH /usr/local/bin

To prepend a directory, even if it's already in your path:

path -f PATH /usr/local/bin

To append a directory:

path -a PATH /usr/local/bin

To remove a directory:

path -d PATH /usr/local/bin

Other Examples

Why?

Because the shell function I wrote that meets my requirements is kind of slow, and I needed a hobby.

Yes, I'm fully aware that Bash scripting is the worst possible hobby.

I'm sticking with Bash anyway. I'm not switching to zsh or whatever.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages