-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclash
More file actions
executable file
·28 lines (25 loc) · 768 Bytes
/
clash
File metadata and controls
executable file
·28 lines (25 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env sh
# compat: +ash +bash +dash +zsh
clash() { ### @- run a command through 11 different shells.
### only returns false when no arguments are given.
[ $# != 0 ] || return
for sh in `__clash_shells`; do
printf >&2 '\033[7m %s \033[m\n' "trying $sh"
"$sh" "$@"
eval "${sh}_x=$?"
done
if [ "$1" = -c ]; then
shift
printf >&2 '\033[7m\043\043\043\043 `%s`\033[m\n' "$*"
else
printf >&2 '\033[7m\043\043\043\043 sh %s\033[m\n' "$*"
fi
for sh in `__clash_shells`; do
printf >&2 '\033[100m#%5s: $? = %s\033[m\n' "$sh" "$((${sh}_x))"
done
true
}
__clash_shells() {
echo ash bash dash ksh loksh mksh oksh osh posh yash zsh
}
[ -n "${preload+-}" ] || clash "$@"