Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

In bash, I can do EDITOR=vim crontab -e. Can I get similar effect in Fish shell?

share|improve this question

3 Answers 3

up vote 20 down vote accepted
begin; set -lx EDITOR vim; crontab -e; end
share|improve this answer
is there any easier way to do this? – Milovan Zogovic Oct 29 '12 at 8:43
oddly, this doesn't work for me. I'm calling a ruby script, and ENV doesn't pick up the variable I'm setting: set -lx date '12/04/2012' – Duke Dec 7 '12 at 23:13
@Duke: It works for me. begin; set -lx date '12/04/2012'; ruby -e 'puts ENV["date"]'; end – Dennis Williamson Dec 8 '12 at 0:49
In the meanwhile this has been answered in the Fish FAQ: – harm Apr 3 '14 at 9:09

Don't see why this shouldn't work: env EDITOR=vim crontab -e
That bypasses the shell completely.

share|improve this answer
This is so much easier. The only problem is that bypassing the shell disallows any custom fish commands, which are probably locked in your muscle memory. – JohnMetta Jun 3 '13 at 20:11

That is from the Documentation

SOME_VAR=1 command produces an error: Unknown command "SOME_VAR=1".

Use the env command.

env SOME_VAR=1 command

You can also declare a local variable in a block and that would not bypass the shell

  set -lx SOME_VAR 1
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.