I actually found following one-liner on commandfu.com:

cmdfu(){ curl "http://www.commandlinefu.com/commands/matching/$@/$(echo -n $@ | openssl base64)/plaintext"; } I have not come across a similar use of the () in bash before.

It seems that it creates the command cmdfu temporarily within the bash environment. Am I correct here? Or is it actually stored somewhere? Is there a name for this construct so I can read up on it?


This is a shell function. If you create it at the command line, it will exist only for the current shell invocation. You can add the definition to a shell startup file (.bashrc, .bash_profile, etc) and it will make it "permanent".

If you search the bash(1) manpage for "Shell Function Definitions" you can see the syntax for defining shell functions. The section "FUNCTIONS" goes into more details of functions themselves.

  • You can also use functions inside scripts to organize and reuse code in the same way you'd use them in other languages. – Paused until further notice. Nov 5 '10 at 2:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.