diff --git a/stowall.sh b/stowall.sh index aca0b97..d6b10a9 100755 --- a/stowall.sh +++ b/stowall.sh @@ -1,20 +1,24 @@ -#!/bin/bash +#!/bin/sh -if [[ $# != 1 ]]; then +if [ $# != 1 ]; then echo "Provide -s or -d switch" - exit -1 + exit 1 fi -for item in $(ls ~/.Dotfiles/) +if [ "${PWD}" != "{HOME}/.Dotfiles" ]; then + echo "Please place this file in ${HOME}/.Dotfiles" +fi + +for item in * do - if [[ -d $item ]]; then - if [[ $1 == '-s' ]]; then - stow -v $item - elif [[ $1 == '-d' ]]; then - stow -vD $item + if [ -d "${item}" ]; then + if [ "$1" = "-s" ]; then + stow -v "${item}" + elif [ "$1" = "-d" ]; then + stow -vD "${item}" else - echo "Unknown option" - exit -2 + echo "Provide -s or -d switch" + exit 2 fi fi done