diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-18 10:33:10 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-18 10:34:31 +1200 |
commit | 2494e31095f094e58a47b13d2454bc8422f207ff (patch) | |
tree | 42839a06a9f0f1e18733d0b68fdc29b37d4941e3 | |
parent | Do away with dircolors and LS_COLORS (diff) | |
download | dotfiles-2494e31095f094e58a47b13d2454bc8422f207ff.tar.gz dotfiles-2494e31095f094e58a47b13d2454bc8422f207ff.zip |
Sort the output of env(1) if no arguments
-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 +} |