From f2d31eca374e41c0ad5daa2e876e499f2078de21 Mon Sep 17 00:00:00 2001 From: Cool Guy Date: Thu, 7 May 2026 09:33:22 +0800 Subject: [PATCH] emulate: add page (#22278) Co-authored-by: Dylan <145150333+dmmqz@users.noreply.github.com> Co-authored-by: Ivan Baluta --- pages/common/emulate.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 pages/common/emulate.md diff --git a/pages/common/emulate.md b/pages/common/emulate.md new file mode 100644 index 0000000000..4fe73d86fe --- /dev/null +++ b/pages/common/emulate.md @@ -0,0 +1,25 @@ +# emulate + +> Reset shell options to match a certain shell's behavior. +> Also used to ensure a shell function runs with the default configuration. +> More information: . + +- Print current emulation mode: + +`emulate` + +- Adjust settings of the current shell session to mimic Bash: + +`emulate bash` + +- Evaluate a [c]ommand within temporary emulation: + +`emulate ksh -c "{{echo hi}}"` + +- Emulate the default Zsh, [R]esetting options when possible: + +`emulate zsh -R` + +- Scope emulation to the current function: + +`{{my_function}}() { emulate -L {{zsh|sh|ksh|csh}}; {{ls}} }`