Followed advice of Open Group about shell command "test"
This commit is contained in:
parent
b97841b782
commit
239244157b
@ -499,7 +499,7 @@ xdt_list_devices() {
|
||||
fi
|
||||
for xdt_trans in $xdt_transports
|
||||
do
|
||||
if test "$xdt_trans" = "usb" -o "$xdt_trans" = "mmcblk"
|
||||
if test "$xdt_trans" = "usb" || test "$xdt_trans" = "mmcblk"
|
||||
then
|
||||
xdt_good_trans="${xdt_trans}+"
|
||||
elif test -n "$xdt_trans"
|
||||
@ -517,7 +517,7 @@ xdt_list_devices() {
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if test -z "$xdt_good_trans" -a -z "$xdt_bad_trans"
|
||||
if test -z "$xdt_good_trans" && test -z "$xdt_bad_trans"
|
||||
then
|
||||
xdt_yucky=y
|
||||
xdt_reasons="${xdt_reasons}no_bus_info- "
|
||||
@ -565,7 +565,7 @@ xdt_list_devices() {
|
||||
# Decide whether the found filesystems look dispensible enough
|
||||
xdt_reasons="${xdt_reasons}${xdt_good_fs}${xdt_bad_fs}"
|
||||
if test "${xdt_bad_fs}${xdt_good_fs}" = "" \
|
||||
-a -z "$xdt_have_su_power"
|
||||
&& test -z "$xdt_have_su_power"
|
||||
then
|
||||
xdt_yucky=y
|
||||
xdt_reasons="${xdt_reasons}no_fs_while_not_su- "
|
||||
@ -584,7 +584,7 @@ xdt_list_devices() {
|
||||
fi
|
||||
|
||||
# Optional tests for size
|
||||
if test -n "$xdt_max_size" -o -n "$xdt_min_size"
|
||||
if test -n "$xdt_max_size" || test -n "$xdt_min_size"
|
||||
then
|
||||
xdt_size=$("$xdt_lsblk_cmd" -n -b -o SIZE /dev/"$xdt_name" \
|
||||
| head -1 | xdt_round_down_div_million)
|
||||
@ -594,7 +594,7 @@ xdt_list_devices() {
|
||||
xdt_reasons="${xdt_reasons}lsblk_no_size- "
|
||||
fi
|
||||
fi
|
||||
if test -n "$xdt_max_size" -a -n "$xdt_size"
|
||||
if test -n "$xdt_max_size" && test -n "$xdt_size"
|
||||
then
|
||||
if test "$xdt_size" -gt "$xdt_max_size"
|
||||
then
|
||||
@ -602,7 +602,7 @@ xdt_list_devices() {
|
||||
xdt_reasons="${xdt_reasons}size_too_large- "
|
||||
fi
|
||||
fi
|
||||
if test -n "$xdt_min_size" -a -n "$xdt_size"
|
||||
if test -n "$xdt_min_size" && test -n "$xdt_size"
|
||||
then
|
||||
if test "$xdt_size" -lt "$xdt_min_size"
|
||||
then
|
||||
@ -757,13 +757,13 @@ xdt_decide_writing()
|
||||
xdt_candidates=$(xdt_list_devices | tr '\n\r' ' ')
|
||||
xdt_num_cand=$(echo $xdt_candidates | wc -w)
|
||||
xdt_num_devs=$(echo $xdt_devs| wc -w)
|
||||
if test -n "$xdt_dummy_force" -a "$xdt_num_devs" -ne 1
|
||||
if test -n "$xdt_dummy_force" && test "$xdt_num_devs" -ne 1
|
||||
then
|
||||
echo "SORRY: Refusing -dummy_force with not exactly one device given." >&2
|
||||
return 10
|
||||
fi
|
||||
if test -n "$xdt_dummy_force" -a -n "$xdt_dummy_run" \
|
||||
-a "$xdt_num_cand" -ne 1
|
||||
if test -n "$xdt_dummy_force" && test -n "$xdt_dummy_run" \
|
||||
&& test "$xdt_num_cand" -ne 1
|
||||
then
|
||||
# -dummy_force in a situation where the program would normally refuse
|
||||
echo
|
||||
@ -791,8 +791,8 @@ xdt_decide_writing()
|
||||
echo "Last chance to abort. Enter the word 'yes' to start REAL WRITING." >&2
|
||||
fi
|
||||
read xdt_dummy
|
||||
if test "$xdt_dummy" = "yes" -o "$xdt_dummy" = "'yes'" \
|
||||
-o "$xdt_dummy" = '"yes"'
|
||||
if test "X$xdt_dummy" = "Xyes" || test "X$xdt_dummy" = "X'yes'" \
|
||||
|| test "X$xdt_dummy" = 'X"yes"'
|
||||
then
|
||||
xdt_dummy=dummy
|
||||
else
|
||||
@ -856,7 +856,7 @@ xdt_main()
|
||||
|
||||
xdt_list_devices || return "$?"
|
||||
|
||||
if test -z "$xdt_list_all" -a -n "$xdt_do_write"
|
||||
if test -z "$xdt_list_all" && test -n "$xdt_do_write"
|
||||
then
|
||||
xdt_decide_writing || return "$?"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user