Ubuntu 22.04 integration: ShellCheck

- Add new SC2312 global exclude.
  ```
  Consider invoking this command separately to avoid masking its return
  value (or use '|| true' to ignore). [SC2312]
  ```

- Correct errors detected by new ShellCheck version.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #14148
This commit is contained in:
szubersk
2022-11-12 22:22:49 +10:00
committed by Brian Behlendorf
parent c3b6fd3d59
commit a5087965fe
10 changed files with 95 additions and 94 deletions
+7 -7
View File
@@ -63,11 +63,11 @@ __zfs_list_filesystems()
__zfs_match_snapshot()
{
local base_dataset="${cur%@*}"
if [ "$base_dataset" != "$cur" ]
if [[ "$base_dataset" != "$cur" ]]
then
$__ZFS_CMD list -H -o name -s name -t snapshot -d 1 "$base_dataset"
else
if [ "$cur" != "" ] && __zfs_list_datasets "$cur" &> /dev/null
if [[ "$cur" != "" ]] && __zfs_list_datasets "$cur" &> /dev/null
then
$__ZFS_CMD list -H -o name -s name -t filesystem,volume -r "$cur" | tail -n +2
# We output the base dataset name even though we might be
@@ -104,7 +104,7 @@ __zfs_match_snapshot()
__zfs_match_snapshot_or_bookmark()
{
local base_dataset="${cur%[#@]*}"
if [ "$base_dataset" != "$cur" ]
if [[ "$base_dataset" != "$cur" ]]
then
if [[ $cur == *@* ]]
then
@@ -114,7 +114,7 @@ __zfs_match_snapshot_or_bookmark()
fi
else
$__ZFS_CMD list -H -o name -s name -t filesystem,volume
if [ -e "$cur" ] && $__ZFS_CMD list -H -o name -s name -t filesystem,volume "$cur" &> /dev/null
if [[ -e "$cur" ]] && $__ZFS_CMD list -H -o name -s name -t filesystem,volume "$cur" &> /dev/null
then
echo "$cur@"
echo "$cur#"
@@ -126,10 +126,10 @@ __zfs_match_multiple_snapshots()
{
local existing_opts
existing_opts="$(expr "$cur" : '\(.*\)[%,]')"
if [ -e "$existing_opts" ]
if [[ -e "$existing_opts" ]]
then
local base_dataset="${cur%@*}"
if [ "$base_dataset" != "$cur" ]
if [[ "$base_dataset" != "$cur" ]]
then
local cur="${cur##*,}"
if [[ $cur =~ ^%|%.*% ]]
@@ -199,7 +199,7 @@ __zfs_complete_multiple_options()
mapfile -t COMPREPLY < <(compgen -W "$options" -- "${cur##*,}")
existing_opts=$(expr "$cur" : '\(.*,\)')
if [ -n "$existing_opts" ]
if [[ -n "$existing_opts" ]]
then
COMPREPLY=( "${COMPREPLY[@]/#/${existing_opts}}" )
fi