Re: [Fish-users] removing a list item in a function

2017-08-23 Thread Kurtis Rader
On Wed, Aug 23, 2017 at 7:12 PM, Mark Volkmann 
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


[Fish-users] removing a list item in a function

2017-08-23 Thread Mark Volkmann
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

set -g colors red green blue
listrm colors green
# The value of colors is not changed.

-- 
R. Mark Volkmann
Object Computing, Inc.
--
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


[Fish-users] fish_user_paths

2017-08-23 Thread Mark Volkmann
I want to make sure I understand when this should be used. Is this correct?

PATH should be configured in config.fish.

fish_user_paths should be set from a terminal in order to make a change
that will affect all current sessions without having to modify config.fish
and source it in all the current and future sessions.

I understand that fish_user_paths is a universal variable and changes to it
will persist. But it seems that if really want a permanent change that is
easy to find later, I should modify PATH in config.fish. If I wanted to see
my path customizations later, my first instinct would be look at my
config.fish rather echoing fish_user_paths.

Looking for clarification

-- 
R. Mark Volkmann
Object Computing, Inc.
--
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