symlink.sh: Fix paths, broken pwd, add svc.sh

Former-commit-id: 18c97dc19ec7cd7f103bfef63f39d0cc8e3e3944
This commit is contained in:
mollusk 2018-03-08 03:52:57 -07:00
parent 76097c01f4
commit b7f80b6de2

View File

@ -1,45 +1,63 @@
#!/bin/bash #!/bin/bash
linkDir="/usr/local/bin"
function juliaLang(){ function juliaLang(){
name="julia" name="julia"
version="0.6.2" version="0.6.2"
linkDir="/usr/bin" linkDir="${linkDir}"
if [ ! -f "${linkDir}/${name}" ];then if [ ! -f "${linkDir}/${name}" ];then
printf "\nLinking $(pwd)/${name}-${version}/bin/${name} to ${linkDir}\n" printf "\nLinking $(pwd)/${name}-${version}/bin/${name} to ${linkDir}\n"
ln -s $(pwd)/${name}-${version}/bin/${name} ${linkDir}/${name} ln -s $(pwd)/${name}-${version}/bin/${name} ${linkDir}/${name}
else else
printf "\n${name} exists in $(which julia)\n" printf "\n${name} exists in ${linkDir}\n"
fi fi
} }
function idd(){ function idd(){
name="idd" name="idd"
linkDir="/usr/bin" linkDir="${linkDir}"
if [ ! -f "${linkDir}/${name}" ];then if [ ! -f "${linkDir}/${name}" ];then
printf "\nLinking ${pwd}/${name} to ${linkDir}\n" printf "\nLinking ${pwd}/${name} to ${linkDir}\n"
ln -s ${pwd}/idd.sh ${linkDir}/${name} ln -s $(pwd)/${name}.sh ${linkDir}/${name}
else else
printf "${name} already exists in $(which idd)\n" printf "${name} already exists in ${linkDir}\n"
fi fi
} }
function svc(){
name="svc"
linkDir="${linkDir}"
if [ ! -f "${linkDir}/${name}" ];then
printf "\nLinking ${pwd}/${name} to ${linkDir}\n"
ln -s $(pwd)/${name}.sh ${linkDir}/${name}
else
printf "${name} already exists in ${linkDir}\n"
fi
}
case "${1}" in case "${1}" in
-r | --remove )
rm -v ${linkDir}/${2};;
julia ) julia )
juliaLang juliaLang;;
;;
idd ) idd )
idd idd;;
;;
svc )
svc;;
test )
echo ${linkDir};;
* ) printf "\n${0} <command>\n" * ) printf "\n${0} <command>\n"
;; ;;