mirror of
https://github.com/notwa/rc
synced 2024-05-04 04:33:24 -07:00
Compare commits
4 Commits
a9f8dd642c
...
d7089c2ff4
Author | SHA1 | Date | |
---|---|---|---|
Connor Olding | d7089c2ff4 | ||
Connor Olding | 8291a65bcf | ||
Connor Olding | 4c128d42f8 | ||
Connor Olding | a0c83289e3 |
|
@ -645,6 +645,11 @@ as a simple example, `echo hey | shcom` produces, verbatim:
|
|||
hey
|
||||
```
|
||||
|
||||
### [shelly](/sh/shelly#L2)
|
||||
|
||||
(perl 5) invoke the first shell found from a list of shells
|
||||
as an interactive, non-login shell. arguments are ignored.
|
||||
|
||||
### [similar](/sh/similar#L8)
|
||||
|
||||
highlight adjacent lines up to the first inequivalent character.
|
||||
|
@ -1172,6 +1177,7 @@ print each argument on its own line.
|
|||
| [scramble](#scramble) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| [scropt](#scropt) | bash | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| [shcom](#shcom) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| [shelly](#shelly) | **perl** | *n/a* | *n/a* | *n/a* | *n/a* |
|
||||
| [similar](#similar) | *sh* | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| [slit](#slit) | dash | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
| [slitt](#slitt) | dash | ✔️ | ✔️ | ✔️ | ✔️ |
|
||||
|
|
0
sh/colors2
Normal file → Executable file
0
sh/colors2
Normal file → Executable file
23
sh/shelly
Executable file
23
sh/shelly
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/env perl
|
||||
### @ shelly
|
||||
### (perl 5) invoke the first shell found from a list of shells
|
||||
### as an interactive, non-login shell. arguments are ignored.
|
||||
|
||||
use strict;
|
||||
use Env qw(@PATH);
|
||||
use File::Spec;
|
||||
|
||||
# arbitrary ordering, feel free to change:
|
||||
my @shells = <zsh osh fish ion bash ash busybox ksh tcsh csh rc dash>;
|
||||
|
||||
for my $s (@shells) {
|
||||
for my $p (@PATH) {
|
||||
my $fp = File::Spec->join($p, $s);
|
||||
my @argv = $s eq "busybox" ? ("sh", "-i") : ($s, "-i");
|
||||
exec {$fp} @argv if -f $fp and -e "$fp";
|
||||
#print STDERR "fail: $fp\n";
|
||||
}
|
||||
}
|
||||
|
||||
print STDERR "$0: gave up; invoking `sh` without arguments...\n";
|
||||
exec {"sh"} "sh";
|
13
tableize
13
tableize
|
@ -55,6 +55,7 @@ tableize() {
|
|||
'!/usr/bin/env bash') pref=bash;;
|
||||
'!/usr/bin/env dash') pref=dash;;
|
||||
'!/usr/bin/env false') pref=false;;
|
||||
'!/usr/bin/env perl') pref=perl;;
|
||||
'!/usr/bin/env sh') pref=sh;;
|
||||
'!/usr/bin/env zsh') pref=zsh;;
|
||||
'!/usr/bin/sh') pref=sh;;
|
||||
|
@ -72,16 +73,22 @@ tableize() {
|
|||
local yay='✔️' # yay='y'
|
||||
local nay='⭕' # nay='✖️' # nay='n'
|
||||
local huh='❔' # huh='?'
|
||||
local etc='*n/a*'
|
||||
|
||||
# TODO: escape underscores in filenames.
|
||||
printf '| [%s](#%s) ' "$fn" "$fn"
|
||||
printf "%$(( 40 - 2 * ${#fn} ))s" '' # funky way to pad the rest of the column
|
||||
[ "$pref" != false ] || pref='**false**'
|
||||
[ "$pref" != sh ] || pref='*sh*'
|
||||
[ -n "$pref" ] && printf '| %10s ' "$pref" || printf '| %9s%s ' '' "$huh"
|
||||
|
||||
local p="$pref"
|
||||
[ "$pref" != false ] || p='**false**'
|
||||
[ "$pref" != perl ] || p='**perl**'
|
||||
[ "$pref" != sh ] || p='*sh*'
|
||||
[ -n "$p" ] && printf '| %10s ' "$p" || printf '| %9s%s ' '' "$huh"
|
||||
|
||||
local t=
|
||||
for t in "$zsh" "$bash" "$dash" "$ash"; do
|
||||
local w="$huh"
|
||||
[ "$pref" != perl ] || w="$etc"
|
||||
[ "$t" != yes ] || w="$yay"
|
||||
[ "$t" != no ] || w="$nay"
|
||||
# can't use '%4s' here because printf gets confused by UTF-8.
|
||||
|
|
Loading…
Reference in New Issue
Block a user