@@ -116,10 +116,11 @@ _scratch_xfs_list_metadata_fields() {
return;
fi
- (for arg in "$@"; do
- echo "${arg}"
+ local cmds=()
+ for arg in "$@"; do
+ cmds+=("-c" "${arg}")
done
- echo "print") | _scratch_xfs_db | __filter_xfs_db_print_fields "${filter}"
+ _scratch_xfs_db "${cmds[@]}" -c print | __filter_xfs_db_print_fields "${filter}"
}
# Get a metadata field
@@ -130,10 +131,11 @@ _scratch_xfs_get_metadata_field() {
shift
grep_key="$(echo "${key}" | tr '[]()' '....')"
- (for arg in "$@"; do
- echo "${arg}"
+ local cmds=()
+ for arg in "$@"; do
+ cmds+=("-c" "${arg}")
done
- echo "print ${key}") | _scratch_xfs_db | grep "^${grep_key}" | \
+ _scratch_xfs_db "${cmds[@]}" -c "print ${key}" | grep "^${grep_key}" | \
sed -e 's/^.* = //g'
}
@@ -145,10 +147,11 @@ _scratch_xfs_set_metadata_field() {
key="$1"
value="$2"
shift; shift
- (for arg in "$@"; do
- echo "${arg}"
+ local cmds=()
+ for arg in "$@"; do
+ cmds+=("-c" "${arg}")
done
- echo "write -d ${key} ${value}") | _scratch_xfs_db -x
+ _scratch_xfs_db -x "${cmds[@]}" -c "write -d ${key} ${value}"
echo
}
@@ -167,10 +170,11 @@ _scratch_xfs_fuzz_metadata_field() {
fuzz_arg="-d"
fi
oldval="$(_scratch_xfs_get_metadata_field "${key}" "$@")"
- (for arg in "$@"; do
- echo "${arg}"
+ local cmds=()
+ for arg in "$@"; do
+ cmds+=("-c" "${arg}")
done
- echo "fuzz ${fuzz_arg} ${key} ${value}") | _scratch_xfs_db -x
+ _scratch_xfs_db -x "${cmds[@]}" -c "fuzz ${fuzz_arg} ${key} ${value}"
echo
newval="$(_scratch_xfs_get_metadata_field "${key}" "$@" 2> /dev/null)"
if [ "${oldval}" = "${newval}" ]; then