Chose one or the other file according to your preference (Mac/Unix)
chmod +x <filename>
=> To make it executable./bash.js foo
=> will create a repositoryfoo
and a filefoo/index.html
./bash.sh bar
=> will create a repositorybar
and a filebar/index.html
Now it will run only in the current directory. If you want to run it globally on your computer
Use a name without extension:
mv cmd.js cmd
ormv cmd.sh cmd
pwd
=> to get your current directory.export PATH=$PATH:<pwd result>/cmd
Now in this terminal, you can always use your command like:
cmd baz
=> will create a repositorybaz
and a filebaz/index.html
But it will work only on this terminal, so use:
- Move your
cmd
file in one of your main directories. e.g:~/scripts
folder - Open the
~/.bash_profile
(depending on your terminal you might need to open one of this other file in the section Set your PATH permanently) - Add to the line
export PATH
(if not already there):export PATH=$PATH:/Users/<username>/scripts/cmd