From 2ef912674415c59c9479965373f816f13fbdb332 Mon Sep 17 00:00:00 2001 From: "David Adam (zanchey)" <zanchey@ucc.gu.uwa.edu.au> Date: Thu, 23 May 2013 13:58:16 +0800 Subject: [PATCH] FAQ: address local variable/env usage --- doc_src/faq.hdr | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc_src/faq.hdr b/doc_src/faq.hdr index 0da40b498..449c10f4f 100644 --- a/doc_src/faq.hdr +++ b/doc_src/faq.hdr @@ -6,6 +6,7 @@ - <a href='#faq-cmd-history'>How do I run a command from history?</a> - <a href='#faq-subcommand'>How do I run a subcommand? The backtick doesn't work!</a> - <a href='#faq-exit-status'>How do I get the exit status of a command?</a> +- <a href='#faq-single-env'>How do I set an environment variable for just one command?</a> - <a href='#faq-customize-colors'>How do I customize my syntax highlighting colors?</a> - <a href='#faq-update-manpage-completions'>How do I update man page completions?</a> - <a href='#faq-cwd-symlink'>Why does cd, pwd and other fish commands always resolve symlinked directories to their canonical path?</a> @@ -77,6 +78,23 @@ other shells. <hr> +\section faq-single-env How do I set an environment variable for just one command? + +<i><tt>SOME_VAR=1 command</tt> produces an error: <tt>Unknown command "SOME_VAR=1"</tt>.</i> + +Use the \c env command. + +<tt>env SOME_VAR=1 command</tt> + +You can also declare a local variable in a block: + +<pre>begin + set -lx SOME_VAR 1 + command +end</pre> + +<hr> + \section faq-customize-colors How do I customize my syntax highlighting colors? Use the web configuration tool,