[dim PATCH 1/2] dim: handle missing declare -n option gracefully

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The declare -n option was added in bash 4.3. Handle missing -n
gracefully, at the expense of losing dim alias functionality.

Cc: Gerd Hoffmann <kraxel@xxxxxxxxxx>
Reported-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
---
 dim | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dim b/dim
index 9500a9df102a..20eac8c58c58 100755
--- a/dim
+++ b/dim
@@ -1598,9 +1598,9 @@ function dim_usage
 	echo "See '$dim help' for more information."
 }
 
-# dim subcommand aliases
-declare -n subcmd=dim_alias_${subcommand//-/_}
-if [ -z "$subcmd" ]; then
+# dim subcommand aliases (with bash 4.3+)
+if ! declare -n subcmd=dim_alias_${subcommand//-/_} &> /dev/null || \
+		test -z "$subcmd"; then
 	subcmd="$subcommand"
 fi
 
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux