I'd like to add a function to my config.fish to do some things over and over
. . . basically, to set my path:

function add_to_path --description 'If the directories exist, add them to
the path'
    for arg in $argv
        if [ -d "$arg" ]
            # Eventually do this uniquely . . .and, allow the function to
specify head or tail of the path.
            set -x PATH $PATH "$arg"
        else
            echo "WARNING:  Directory [$arg] does not exist -- not adding to
PATH"
        end
    end
end



Then, later on in the config.fish, actually use it:

add_to_path ~/.gem/ruby/1.8/bin
add_to_path ~/bin

etc . .

But, I don't want this function to exist after config.fish is done.  Should
I just erase it before the end of my config.fish:

functions -e add_to_path

Or is there an easier way to make a function that is non-global in scope?


I think this will be my last stupid question of the AM . . . .:)

-Dave
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to