0

i have a deployment project that i use to deploy some of my stuff on remote servers.

i've written some bash scripts to make this all easy and and fun, and now when i want to deploy a project i have a deploy.sh script which i run as such: ./deploy.sh my-project-to-deploy and its all good. but i want to make it a bit simpler, so that in order to deploy i will only need to write it as a bash command: deploy my-project-to-deploy. is there any way for me to do so? i only need this to work locally in my root dir of the deployments project, not everywhere. and if its possible, i want this to not be something you have to configure on your computer so that people who pull the project from git could use this command right away. many thanks for anyone who can help.

  • 1
    Put it in a directory named in your PATH (`/usr/local/bin` is conventional for systemwide installation, but you can also make a `$HOME/bin` and add that to your PATH through your `.bash_profile` or similar), and take the `.sh` off the filename. (bash scripts *are not* sh scripts, so using `.sh` is actively misleading -- and anyhow, extensions are for libraries, not executables; you start `pip`, not `pip.py`, even though `pip` is written in Python; see also [commandname extensions considered harmful](https://www.talisman.org/~erlkonig/documents/commandname-extensions-considered-harmful/)). – Charles Duffy Mar 06 '22 at 17:12

0 Answers0