mirror of
https://github.com/notwa/rc
synced 2024-11-05 07:29:04 -08:00
20 lines
575 B
Bash
Executable file
20 lines
575 B
Bash
Executable file
#!/usr/bin/sh
|
|
# compat: +ash +bash +dash +hush +ksh +mksh +oksh +osh +posh +yash +zsh
|
|
|
|
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
|
|
### ```
|
|
|
|
[ $# -ge 2 ] || { printf "%s\n" "$0: too few arguments" >&2; return 1; }
|
|
local ex="$1"
|
|
shift
|
|
"$@" | "$ex"
|
|
}
|
|
|
|
[ -n "${preload+-}" ] || ify "$@"
|