This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ for sh in bash bb dash yash gash bosh ksh kshv mksh loksh posh zsh mrsh; do printf '%-6s ' "${sh}:"; "$sh" -c 'IFS=0; bash -c "printf \"%q \" \"\$@\"" bash $((x=1101001101))$((x))$((IFS=!IFS))${x}$((x)) ${x}$((x)) "${y:=$((x))}"${y+${z=$((y))}"$((y))"${z}$((IFS=!IFS))}' 2>&3; echo; done 3>/dev/null | |
bash: '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' 0 00 '' 0 110100110111 1 '' 11 1110100110111 1 '' 11 1 | |
bb: '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' 0 00 '' 0 110100110111 1 '' 11 1110100110111 1 '' 11 1 | |
dash: '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' 0 00 '' 0 110100110111 1 '' 11 1110100110111 1 '' 11 1 | |
yash: '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' 0 00 '' 0 110100110111 1 '' 11 1110100110111 1 '' 11 1 | |
gash: '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' 0 00 '' 0 '' '' 0 00 '' 0 11010011011 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%hidden trace='strace -DDYYyqqqf' | |
%hidden el=/usr/bin/execlineb | |
%hidden bashargs='-sipo vi +o posix +o histexpand -O lastpipe -O extglob -O expand_aliases +O array_expand_once +O sourcepath' | |
%hidden kshargs='-sipo vi -o posix' | |
%hidden shexec='import os, os.path, sys, pwd; \ | |
os.sched_setscheduler(0, os.SCHED_OTHER, os.sched_param(0)); \ | |
os.nice(-os.getpriority(os.PRIO_PROCESS, 0)); \ | |
os.environ.setdefault("TMPDIR", "/tmp"); \ | |
os.environ.setdefault("BASH_COMPAT", "51"); \ | |
p = { k: str(v) for k, v in zip(("USER", None, "UID", "GID", None, "HOME", "SHELL"), pwd.getpwuid(os.geteuid())) if k }; \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
BASH_COMPAT=51 | |
# Swap or merge keys and indices | |
function arr2set { | |
typeset -i n m | |
typeset -n _ret=$1 r | |
[[ ${_ret@a} == *A* ]] || return | |
shift | |
for r do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0: 0,4 | |
1: 0,5 | |
2: 0,6 | |
3: 0,2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S-- BASH_COMPAT=51 bash -O lastpipe -O extglob -O expand_aliases +O assoc_expand_once +O sourcepath | |
typeset x | |
x=$(pkgconf --var=loadablesdir bash) && | |
[[ ! $BASH_LOADABLES_PATH =~ (^|:)"$x"($|:) ]] && | |
BASH_LOADABLES_PATH+=${BASH_LOADABLES_PATH:+:}${x} | |
for x in asort mktemp | |
do enable -f "$x"{,} || exit | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ins)ormaaj 65 (2713681) 2 ~ $ function f { unset -f f; typeset -ia fd; typeset -n fdn=fd[\${#fd[@]}]; { env -- BASH_FUNC_pre_pkg_{pretend,setup}'%%=() { function tc-check-openmp { return 0; }; }' execlineb -- "/proc/self/fd/${fd[0]}" "${fd[@]}"; } {fdn}<<\EOF {fdn}<<\EOF; typeset x; for x in "${fd[@]}"; do exec {x}<&-; done; }; f | |
fdreserve 1 | |
multisubstitute { | |
importas -iu f0 FD0 | |
elgetpositionals | |
} | |
emptyenv -P | |
fdclose $1 | |
define -sd " " v "${2} ${f0}" | |
creatememfd $f0 "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\unset -v aliasrestore | |
aliasrestore=$(\alias -p) aliasrestore+=${aliasrestore:+$'\n\\'unset -v aliasrestore} | |
\unalias -a | |
function setupGlobalAliases { | |
alias -- \ | |
'--=-- ' \ | |
'l-=local -' \ | |
'fn=function ' \ | |
'exec=exec ' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/false | |
\typeset -a bool; bool+=([1]=) | |
\typeset -n sh_file | |
\test -v KSH_VERSION | |
sh_file=${bool[$?]+bash_source[0]}${bool[!$?]+.sh.file} | |
dotFilesPath=$(\findmnt -umlnfo target -O subvol=/vol/dotfiles "PARTUUID=$(\findmnt -umlnfo partuuid -T /)") | |
[[ $sh_file == ?(*/)shell ]] | |
\source -- ${bool[!$?]+"$sh_file"}${bool[$?]+"${dotFilesPath}/common/home/shell"}/functions | |
rc_main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ { function f { lsfd -np "$BASHPID" --summary=only -C ' :ASSOC == "mem"'; }; typeset -fx f; f; bash -ic 'f; type -t print; print -r :\); type -t print; f; print -r :D'; } | tr -s '\n ' ' '; echo | |
247 31 function :) builtin 36 :D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
typeset -ga bool=([1]=) | |
# Usage: in_array name outvar | |
function fmtarr { | |
typeset x=1 y max ret=$3 | |
printf -v "$ret" '%s+=(' "$2" | |
eval -- set -- "\"\${!${1}[@]}\"" "\"\${${1}[@]}\"" || return | |
((max = $# / 2)) |
NewerOlder