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 <[email protected]>
Reported-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Jani Nikula <[email protected]>
---
 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to