Categories
Linux Mastering Development

Correct way to take a function from the current shell and save it for future use?

I’ve been writing a lot of one-off functions recently. On the occasions that I go "hmm, I should save this" I use type <function name> to show the code, and copy and paste it into .bashrc. Is there a faster way to do this, or some standard or command built for this purpose?

FWIW, I’m just doing this on my personal computer running Mint, so conveniences like copy and paste are easy. However, I’m also interested in answers specific to shell-only environments.

Leave a Reply

Your email address will not be published. Required fields are marked *