Search code examples
bashmacosderby

How to add app variable to the .bash_profile on mac?


I know how to export directions in bash_profile, but how can i set variable to open an app?

For example, i work with Apache Derby on my project, and already set DERBY_INSTALL and CLATHPATH, so i can open my "startNetworkServer" and "ji" directly from Finder, but i want to set variable in bash_profile, to easily use it from terminal, and don't always go to the root folder, for example make variable "startderby" and it runs my "startNetworkServer" in /Users/Vladimir/Apache/db-derby-10.14.2.0-bin/bin


Solution

  • You can define a function in .bash_profile, by writing something like

    startderby(){
        cd /Users/Vladimir/Apache/db-derby-10.14.2.0-bin/bin;
        ./startNetworkServer;
    }
    

    where you would of course put the actual commands you need.