Skip to content

Commit

Permalink
Make POSIX. Quote variables to prevent splitting.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sqvid committed Jan 7, 2023
1 parent 83221e0 commit 58d91bf
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions stowall.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 58d91bf

Please sign in to comment.