diff options
-rw-r--r-- | README.markdown | 3 | ||||
-rw-r--r-- | sh/shrc.d/env.sh | 8 |
2 files changed, 11 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown index 034f8185..76521f0a 100644 --- a/README.markdown +++ b/README.markdown @@ -168,6 +168,9 @@ in `sh/shrc.d` to be loaded by any POSIX interactive shell. Those include: * `diff()` forces the unified format for `diff(1)`. * `ed()` tries to get verbose error messages, a prompt, and a Readline environment for `ed(1)`. +* `env()` sorts the output of `env(1)` if it was invoked with no arguments, + because the various shells have different ways of listing exported + variables. * `gdb()` silences startup messages from `gdb(1)`. * `gpg()` quietens `gpg(1)` down for most commands. * `hgrep()` allows searching `$HISTFILE`. diff --git a/sh/shrc.d/env.sh b/sh/shrc.d/env.sh new file mode 100644 index 00000000..4fa980f2 --- /dev/null +++ b/sh/shrc.d/env.sh @@ -0,0 +1,8 @@ +# Sort the output of env(1) for me +env() { + if [ "$#" -eq 0 ] ; then + command env | sort + else + command env "$@" + fi +} |