help-bash
[Top][All Lists]
Advanced

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

Re: whats wrong with my code , [[ $arg == s ]] and case $a in .. not wor


From: Greg Wooledge
Subject: Re: whats wrong with my code , [[ $arg == s ]] and case $a in .. not working
Date: Sat, 4 Mar 2023 18:13:29 -0500

On Sat, Mar 04, 2023 at 11:48:55PM +0100, alex xmb ratchev wrote:

=============================================
#!/bin/bash
unset -v a r IFS
IFS=$' \t\n'
   for a ; do
  case $a in
 s)
r+=( search ) ;;
 S)
r+=( show ) ;;
 *)
r+=( "$a" ) ;;
  esac
   done

apt-cache "$@"
=============================================

You're assigning words to an array named r, but then you never use
that array.  You're passing the original "$@" instead of "${r[@]}".



reply via email to

[Prev in Thread] Current Thread [Next in Thread]