diff --git a/test/108_accept_alt.bats b/test/108_accept_alt.bats index 004fd79..c6cecea 100644 --- a/test/108_accept_alt.bats +++ b/test/108_accept_alt.bats @@ -10,7 +10,7 @@ function create_encrypt() { echo "$efile" >> "$T_YADM_ENCRYPT" echo "$efile" >> "$T_DIR_WORK/$efile" mkdir -p "$T_DIR_WORK/dir one/$efile" - echo "'dir one'/$efile/file1" >> "$T_YADM_ENCRYPT" + echo "dir one/$efile/file1" >> "$T_YADM_ENCRYPT" echo "dir one/$efile/file1" >> "$T_DIR_WORK/dir one/$efile/file1" done } diff --git a/test/109_accept_encryption.bats b/test/109_accept_encryption.bats index 8f0eb69..449487b 100644 --- a/test/109_accept_encryption.bats +++ b/test/109_accept_encryption.bats @@ -96,14 +96,16 @@ EOF while IFS='' read -r glob || [ -n "$glob" ]; do if [[ ! $glob =~ ^# && ! $glob =~ ^[[:space:]]*$ ]] ; then local IFS=$'\n' - for matching_file in $(eval ls -d "$glob" 2>/dev/null); do - if [ -d "$matching_file" ]; then - echo "$matching_file/" - for subfile in "$matching_file"/*; do - echo "$subfile" - done - else - echo "$matching_file" + for matching_file in $glob; do + if [ -e "$matching_file" ]; then + if [ -d "$matching_file" ]; then + echo "$matching_file/" + for subfile in "$matching_file"/*; do + echo "$subfile" + done + else + echo "$matching_file" + fi fi done fi @@ -297,7 +299,7 @@ EOF #; add paths with spaces to YADM_ARCHIVE local original_encrypt original_encrypt=$(cat "$T_YADM_ENCRYPT") - echo -e "'space test'/file*" >> "$T_YADM_ENCRYPT" + echo -e "space test/file*" >> "$T_YADM_ENCRYPT" #; run encrypt run expect <> "$T_YADM_ENCRYPT" + echo -e "space test" >> "$T_YADM_ENCRYPT" #; run encrypt run expect <$glob<-" local IFS=$'\n' - for matching_file in $(eval "$LS_PROGRAM" -d "$glob" 2>/dev/null); do - ENC_FILES[$index]="$matching_file" - ((index++)) + for matching_file in $glob; do + if [ -e "$matching_file" ]; then + ENC_FILES[$index]="$matching_file" + ((index++)) + fi done fi done < "$YADM_ENCRYPT" @@ -460,9 +462,11 @@ function encrypt() { while IFS='' read -r glob || [ -n "$glob" ]; do if [[ ! $glob =~ ^# && ! $glob =~ ^[[:space:]]*$ ]] ; then local IFS=$'\n' - for matching_file in $(eval "$LS_PROGRAM" -d "$glob" 2>/dev/null); do - ENC_FILES[$index]="$matching_file" - ((index++)) + for matching_file in $glob; do + if [ -e "$matching_file" ]; then + ENC_FILES[$index]="$matching_file" + ((index++)) + fi done fi done < "$YADM_ENCRYPT" @@ -710,8 +714,11 @@ function perms() { #; include globs found in YADM_ENCRYPT (if present) if [ -f "$YADM_ENCRYPT" ] ; then while IFS='' read -r glob || [ -n "$glob" ]; do - if [[ ! $glob =~ ^# ]] ; then - GLOBS=("${GLOBS[@]}" $(eval "$LS_PROGRAM" -d "$glob" 2>/dev/null)) + if [[ ! $glob =~ ^# && ! $glob =~ ^[[:space:]]*$ ]] ; then + local IFS=$'\n' + for matching_file in $glob; do + GLOBS=("${GLOBS[@]}" "$matching_file") + done fi done < "$YADM_ENCRYPT" fi