js-d-coder/todo.sh

/usr/local/bin

JaxxArmstrong opened this issue · 3 comments

No need to copy the script anywhere. Especially if you have git clone'd the repo. Just do a symbolic link to the script in question to /usr/local/bin. That way you can just do a git pull to update and no extra step to re-copy the script again.

You can also create a tiny install-script that does the symbolic link for you.

#!/bin/bash
scriptDir=$(dirname $(readlink -f $0))
sudo ln -s $scriptDir/todo.sh /usr/local/bin/

Just my two cents.

Ps. From my own perspective I wouldn't mind if you didn't call the dir 'todo.sh', ie removed the .sh at the end. This is just a personal reflection.

Thanks for your feedback.
I named the repo as todo.sh because I might rewrite this script into another language, for example, in Python and create another repo named todo.py, keeping existing one too. In this way I can learn to compare two languages and remove confusion between github repos that do the same task.
As for your idea of using symbolic link, it is brilliant and simple.

You might want to put double quotes around $scriptDir to prevent splitting and wildcard expansion.

#!/bin/bash
scriptDir=$(dirname $(readlink -f $0))
sudo ln -s "$scriptDir/todo.sh" /usr/local/bin/

You're quite right. It was just an example early in the morning with a half-empty whiskey bottle beside the mouse.