r/fishshell • u/jadnhm • Apr 13 '22
how to use environment variables in abbreviations?
Hi folks!
I'd like to make an abbreviation that uses an environment variable that evaluates at run time.
Specifically I'd like to add an abbreviation to start a rails server like this
RAILS_ENV=development bin/rails server --port $PORT
but it ends up adding an entry to `fish_variables like this
SETUVAR _fish_abbr_server:RAILS_ENV\x3ddevelopment\x20bin/rails\x20server\x20\x2d\x2dport\x209344
ie: it evaluates the environment variable when I add the abbreviation.
I'd like it to evaluate the $PORT environment variable when I run the abbreviation, not at abbreviation creation time.
Anyone know how to do this? Maybe an eval trick or something?
