2021-07-29 00:37:35 -07:00
|
|
|
#!/usr/bin/sh
|
|
|
|
# YES_ZSH
|
2021-07-29 05:44:12 -07:00
|
|
|
# YES_BASH
|
|
|
|
# YES_DASH
|
2021-07-29 00:37:35 -07:00
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
ify() { ### @-
|
|
|
|
### pipe one command through another, so you can still pass arguments to the former.
|
|
|
|
###
|
|
|
|
### this is mainly useful for aliases. 99% of the time you'll use this with `less`.
|
|
|
|
###
|
|
|
|
### ```
|
|
|
|
### $ alias ll="ify less ls -ACX --group-directories-first --color=force"
|
|
|
|
### $ ll /etc
|
|
|
|
### ```
|
|
|
|
|
2021-07-29 00:37:35 -07:00
|
|
|
[ $# -ge 2 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }
|
|
|
|
local ex="$1"
|
|
|
|
shift
|
|
|
|
"$@" | "$ex"
|
|
|
|
}
|
|
|
|
|
2021-08-02 13:48:46 -07:00
|
|
|
[ -n "${preload+-}" ] || ify "$@"
|