Maggick
Maggick

Reputation: 793

Where to save/store unix function?

This is probably a very basic question but I could not find a good answer anywhere, also sorry I didn't post this to the Unix version of StackExchange I didn't want to create an account for a simple question. Heads up I'm using a Mac, so not sure if that will effect the answer

I created a unix function

tap()
{
     touch $1
     open $1
}

My problem is I don't know where I should write/save the function.

I put this function in my .bashrc but when I try calling tap it does not work. Is there something I should do to activate it? I did source .bashrc but this did not work. Where should I put it.

Upvotes: 0

Views: 42

Answers (1)

wilsotc
wilsotc

Reputation: 800

Save it as a file.

vim tap
touch $1
open $1
:wq

chmod +x tap
sudo mv tap /usr/local/bin

Upvotes: 1

Related Questions