If you’re a reasonably serious shell user you probably know that you’ve got to write some things as shell functions instead of scripts because they need to modify the state of the shell itself. Usually that’s altering environment variables or changing the working directory of the shell. Often it’s just that you want to save some state for later and don’t want to deal with saving it to a file and parsing it back later.

I’ve got an old shell function called gcd that changes directory to a predefined location where I keep my projects. It also has autocomplete based on the project names. I originally write it with support for cloning repos, so you’d just do gcd https://codeberg.org/willhbr/dotfiles.git and it w…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help