Can I list source for already defined bash functions?

A accidentally some changes to my bash configuration I keep in git by doing git reset --hard head in an incorrect directory. In particular some nifty functions I used. I have a terminal running which still has these functions loaded, can I still reconstruct them from the environment somehow?

Answers


If you defined them as functions in a file your sourced from something like .bashrc or .profile you should be able to use bash's type command.

$ type your_nifty_function

$ declare -f

will list all functions defined in the current shell.


declare

declare will print out all the functions defined. (And all environment variables as well).

alias

alias will print out all aliases defined.


Need Your Help

Vectorize comparison of a row vector with every row of a dataframe in R?

r vector

Suppose I have a data frame that comes from reading in the following file Foo.csv

How can I send UDP messages to a client that is behind LAN network?

network-programming udp client-server lan udpclient

I'm building a server that use UDP protocol to send and receive UDP message to and from clients.