私は〜/ .configを中に設定ファイルを編集するための基本的なスクリプトを持っている - それはcd
線で動作しますが、それは冗長なようだ:バッシュ変数の代入
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
はそれが"$dir"
が失敗した変数を使用して変更します。私は間違って何をしていますか?
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"];それから:; else if cd "$ dir" ...単に 'if [-d" $ dir "]の代わりに; cd "$ dir" ... '? –
@glennありがとう:無知。純粋でシンプルな – Edouard