I have a basic script to edit config files in ~/.config - it works with the cd lines, but that seems redundant:
dir=$HOME/.config/$1
if [ ! -d "$dir" ]; then :
else
cd "$dir" &&
for file in * ; do
case "$file" in
conf | config | *.cfg | *rc) $EDITOR "$file" ;;
*) : ;;
esac
done
cd - 1>/dev/null;
fi
Changing it to use the variable "$dir" fails. What am I doing wrong?
dir=$HOME/.config/$1
if [ ! -d "$dir" ]; then :
else
for file in "$dir" ; do
case "$file" in
conf | config | *.cfg | *rc) $EDITOR "$file" ;;
*) : ;;
esac
done;
fi
if [ ! -d "$dir" ]; then :; else cd "$dir" ...instead of simplyif [ -d "$dir" ]; then cd "$dir" ...?