Fixed ls usages to accept paths with spaces.

This commit is contained in:
Marcus Whybrow 2012-05-31 08:19:18 +01:00
parent 04297c726d
commit 4f354a078b

View File

@ -7,7 +7,9 @@ _msm() {
current="${COMP_WORDS[$COMP_CWORD]}" current="${COMP_WORDS[$COMP_CWORD]}"
if [[ $COMP_CWORD == 1 ]]; then if [[ $COMP_CWORD == 1 ]]; then
local servers=$(ls -1 $SERVER_STORAGE_PATH) if [ -d "$SERVER_STORAGE_PATH" ]; then
local servers="$(ls -1 "$SERVER_STORAGE_PATH")"
fi
options="help start stop restart server jargroup $servers" options="help start stop restart server jargroup $servers"
else else
case "${COMP_WORDS[1]}" in case "${COMP_WORDS[1]}" in
@ -22,8 +24,8 @@ _msm() {
else else
case "${COMP_WORDS[2]}" in case "${COMP_WORDS[2]}" in
delete|rename) delete|rename)
if [[ $COMP_CWORD == 3 ]]; then if [[ $COMP_CWORD == 3 && -d "$SERVER_STORAGE_PATH" ]]; then
options="$(ls -1 $SERVER_STORAGE_PATH)" options="$(ls -1 "$SERVER_STORAGE_PATH")"
fi fi
;; ;;
esac esac
@ -35,8 +37,8 @@ _msm() {
else else
case "${COMP_WORDS[2]}" in case "${COMP_WORDS[2]}" in
delete|rename|changeurl|getlatest) delete|rename|changeurl|getlatest)
if [[ $COMP_CWORD == 3 ]]; then if [[ $COMP_CWORD == 3 && -d "JAR_STORAGE_PATH" ]]; then
options="$(ls -1 $JAR_STORAGE_PATH)" options="$(ls -1 "$JAR_STORAGE_PATH")"
fi fi
;; ;;
esac esac
@ -73,7 +75,7 @@ _msm() {
fi fi
if [ -d "$world_dir" ]; then if [ -d "$world_dir" ]; then
options="$(ls -1 $world_dir)" options="$(ls -1 "$world_dir")"
fi fi
;; ;;
esac esac