On Wed, Aug 23, 2017 at 7:12 PM, Mark Volkmann <r.mark.volkm...@gmail.com>
wrote:

> What am I doing wrong in the function below that accepts the name of a
> variable and an item to be removed and attempts to remove it?
>
> function listrm -a listName item
>   set list $$listName
>   if set -l index (contains -i $item $list)
>     set -eg $listName[$index]
>   else
>     echo $item was not found in $listName
>   end
> end
>

You've made a subtle mistake that is practically a FAQ. See
http://fishshell.com/docs/current/index.html#expand-variable. You want

set -eg $listName[1][$index]

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Fish-users mailing list
Fish-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to