Wrapped command path variables in double quotes
This commit is contained in:
parent
02e55a9dbc
commit
f7f484de20
@ -230,7 +230,7 @@ arg_interpreter() {
|
|||||||
elif test -n "$with_sudo"
|
elif test -n "$with_sudo"
|
||||||
then
|
then
|
||||||
echo "Testing sudo to possibly get password prompting done now:" >&2
|
echo "Testing sudo to possibly get password prompting done now:" >&2
|
||||||
if sudo $lsblk_cmd -h >/dev/null
|
if sudo "$lsblk_cmd" -h >/dev/null
|
||||||
then
|
then
|
||||||
echo "sudo $lsblk_cmd seems ok." >&2
|
echo "sudo $lsblk_cmd seems ok." >&2
|
||||||
echo >&2
|
echo >&2
|
||||||
@ -256,7 +256,7 @@ plug_in_watcher() {
|
|||||||
echo "and then unplug it." >&2
|
echo "and then unplug it." >&2
|
||||||
echo "Press the Enter key when ready." >&2
|
echo "Press the Enter key when ready." >&2
|
||||||
read dummy
|
read dummy
|
||||||
old_device_list=' '$($lsblk_cmd -d -n -o NAME | grep -v '^sr[0-9]' | grep -v '^fd[0-9]' | tr '\n\r' ' ')' '
|
old_device_list=' '$("$lsblk_cmd" -d -n -o NAME | grep -v '^sr[0-9]' | grep -v '^fd[0-9]' | tr '\n\r' ' ')' '
|
||||||
|
|
||||||
# <<< Mock-up to save USB socket wear-off by erasing items from old_device_list
|
# <<< Mock-up to save USB socket wear-off by erasing items from old_device_list
|
||||||
# <<< Their presence in new_device_list will let them appear as fresh plugs
|
# <<< Their presence in new_device_list will let them appear as fresh plugs
|
||||||
@ -271,7 +271,7 @@ plug_in_watcher() {
|
|||||||
end_time="$(expr $(date +'%s') + 10)"
|
end_time="$(expr $(date +'%s') + 10)"
|
||||||
while test $(date +'%s') -le "$end_time"
|
while test $(date +'%s') -le "$end_time"
|
||||||
do
|
do
|
||||||
new_device_list=' '$($lsblk_cmd -d -n -o NAME | grep -v '^sr[0-9]' | grep -v '^fd[0-9]' | tr '\n\r' ' ')' '
|
new_device_list=' '$("$lsblk_cmd" -d -n -o NAME | grep -v '^sr[0-9]' | grep -v '^fd[0-9]' | tr '\n\r' ' ')' '
|
||||||
if test "$old_device_list" = "$new_device_list"
|
if test "$old_device_list" = "$new_device_list"
|
||||||
then
|
then
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -327,7 +327,7 @@ list_devices() {
|
|||||||
if test -z "$devs"
|
if test -z "$devs"
|
||||||
then
|
then
|
||||||
# Obtain list of top-level names which do not look like CD or floppy.
|
# Obtain list of top-level names which do not look like CD or floppy.
|
||||||
devs=$($lsblk_cmd -d -n -o NAME | grep -v '^sr[0-9]' | grep -v '^fd[0-9]')
|
devs=$("$lsblk_cmd" -d -n -o NAME | grep -v '^sr[0-9]' | grep -v '^fd[0-9]')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
not_advised=0
|
not_advised=0
|
||||||
@ -368,7 +368,7 @@ list_devices() {
|
|||||||
transports=not_an_expected_name
|
transports=not_an_expected_name
|
||||||
reasons="${reasons}name_with_slash- "
|
reasons="${reasons}name_with_slash- "
|
||||||
else
|
else
|
||||||
transports=$($lsblk_cmd -n -o TRAN /dev/"$name")
|
transports=$("$lsblk_cmd" -n -o TRAN /dev/"$name")
|
||||||
fi
|
fi
|
||||||
if test -z "$transports"
|
if test -z "$transports"
|
||||||
then
|
then
|
||||||
@ -405,7 +405,7 @@ list_devices() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Wanted or unwanted filesystem types
|
# Wanted or unwanted filesystem types
|
||||||
fstypes=$($sudo_cmd $lsblk_cmd -n -o FSTYPE /dev/"$name")
|
fstypes=$("$sudo_cmd" "$lsblk_cmd" -n -o FSTYPE /dev/"$name")
|
||||||
if test "$?" -gt 0
|
if test "$?" -gt 0
|
||||||
then
|
then
|
||||||
fstypes="lsblk_fstype_error"
|
fstypes="lsblk_fstype_error"
|
||||||
@ -465,7 +465,7 @@ list_devices() {
|
|||||||
# Optional tests for size
|
# Optional tests for size
|
||||||
if test -n "$max_size" -o -n "$min_size"
|
if test -n "$max_size" -o -n "$min_size"
|
||||||
then
|
then
|
||||||
size=$($lsblk_cmd -n -b -o SIZE /dev/"$name" | head -1 | round_down_div_million)
|
size=$("$lsblk_cmd" -n -b -o SIZE /dev/"$name" | head -1 | round_down_div_million)
|
||||||
if test -z "$size"
|
if test -z "$size"
|
||||||
then
|
then
|
||||||
yucky=y
|
yucky=y
|
||||||
@ -493,7 +493,7 @@ list_devices() {
|
|||||||
descr=
|
descr=
|
||||||
if test -n "$with_vendor_model"
|
if test -n "$with_vendor_model"
|
||||||
then
|
then
|
||||||
descr=": "$($lsblk_cmd -n -o VENDOR,MODEL /dev/"$name" | tr '\n\r' ' ' | tr -s ' ')
|
descr=": "$("$lsblk_cmd" -n -o VENDOR,MODEL /dev/"$name" | tr '\n\r' ' ' | tr -s ' ')
|
||||||
fi
|
fi
|
||||||
if test -n "$yucky"
|
if test -n "$yucky"
|
||||||
then
|
then
|
||||||
@ -516,7 +516,7 @@ list_devices() {
|
|||||||
|
|
||||||
## Puts list of mounted (sub-)devices of $1 into $mounted_devs
|
## Puts list of mounted (sub-)devices of $1 into $mounted_devs
|
||||||
list_mounted_of() {
|
list_mounted_of() {
|
||||||
partitions=$($lsblk_cmd -n -p -o NAME /dev/"$1" | grep -v '^'/dev/"$1"'$' \
|
partitions=$("$lsblk_cmd" -n -p -o NAME /dev/"$1" | grep -v '^'/dev/"$1"'$' \
|
||||||
| sed -e 's/[^a-zA-Z0-9_+@:.,/-]//g' | tr '\n\r' ' ')
|
| sed -e 's/[^a-zA-Z0-9_+@:.,/-]//g' | tr '\n\r' ' ')
|
||||||
mounted_devs=
|
mounted_devs=
|
||||||
for i in /dev/"$1" $partitions
|
for i in /dev/"$1" $partitions
|
||||||
@ -559,7 +559,7 @@ write_image() {
|
|||||||
then
|
then
|
||||||
echo " $sudo_cmd $umount_cmd $i"
|
echo " $sudo_cmd $umount_cmd $i"
|
||||||
else
|
else
|
||||||
if $sudo_cmd $umount_cmd "$i"
|
if "$sudo_cmd" "$umount_cmd" "$i"
|
||||||
then
|
then
|
||||||
echo "Unmounted: $i"
|
echo "Unmounted: $i"
|
||||||
else
|
else
|
||||||
@ -592,7 +592,7 @@ write_image() {
|
|||||||
else
|
else
|
||||||
echo "Performing:"
|
echo "Performing:"
|
||||||
echo " $sudo_cmd $dd_cmd if='${1}' bs=1M of=/dev/'${2}' ; sync"
|
echo " $sudo_cmd $dd_cmd if='${1}' bs=1M of=/dev/'${2}' ; sync"
|
||||||
$sudo_cmd $dd_cmd if="${1}" bs=1M of=/dev/"${2}" ; sync
|
"$sudo_cmd" "$dd_cmd" if="${1}" bs=1M of=/dev/"${2}" ; sync
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# >>> ??? Erase possible GPT backup table at end of device ?
|
# >>> ??? Erase possible GPT backup table at end of device ?
|
||||||
|
Loading…
Reference in New Issue
Block a user