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
IFS=: read -ra paths <<<"$PATH"; eval "printf '<%s> ' find / \( -type d \( $(printf -- '-name %q -o ' "${paths[@]::${#paths[@]} - 1}") -name \"\${paths[-1]}\" \) \) -prune -o \( -type f -executable -print -quit \)" ) |
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
NAME | |
compgen - command completion. | |
SYNOPSIS | |
compgen [ options ] [word ...] | |
DESCRIPTION | |
Specify how arguments to each name should be completed. If the -p option is | |
supplied, or if no options are supplied, existing completion specifications | |
are printed to standard output in a way that allows them to be reused as |
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
`configure' configures mono 4.3.0 to adapt to many kinds of systems. | |
Usage: ./configure [OPTION]... [VAR=VALUE]... | |
To assign environment variables (e.g., CC, CFLAGS...), specify them as | |
VAR=VALUE. See below for descriptions of some of the useful variables. | |
Defaults for the options are specified in brackets. | |
Configuration: |
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 ksh mksh zsh bash; do "$sh" /dev/fd/3; done ) 3<<\EOF | |
${ZSH_VERSION+'false'} || emulate ksh | |
${BASH_VERSION+shopt -s expand_aliases} | |
${KSH_VERSION+\:} alias integer=typeset | |
[[ ${!KSH_VERSION} == .sh.version ]] || alias .= | |
function f { | |
${1+'false'} || integer depth=$1 iter=$2 | |
if ((!depth--)); then | |
integer i=$iter |
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
$ doc/projects/bash/testcases/pattest.py | |
bash dash ksh mksh zsh bb posh jsh | |
x=\\; case \\x in "${x}""${x}"x) :;; *) false; esac 1 1 1 1 1 1 1 1 | |
x=\\; case \\x in "${x}"${x}x) :;; *) false; esac 0 0 1 1 1 1 1 1 | |
x=\\; case \\x in "${x}""\\"x) :;; *) false; esac 1 1 1 1 1 1 1 1 | |
x=\\; case \\x in "${x}"\\x) :;; *) false; esac 1 1 1 1 1 1 1 1 | |
x=\\; case \\x in ${x}"${x}"x) :;; *) false; esac 1 0 1 1 1 1 1 1 | |
x=\\; case \\x in ${x}${x}x) :;; *) false; esac 0 0 1 1 1 1 1 1 | |
x=\\; case \\x in ${x}"\\"x) :;; *) false; esac 1 0 1 1 1 1 1 1 | |
x=\\; case \\x in ${x}\\x) :;; *) false; esac 1 0 1 1 1 1 1 1 |
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 | |
shopt -s extglob | |
a='aaabbbbccccc' | |
# Could be half this length if string assignment in an arithmetic context worked, or if the "foo" in ${#foo} could be any expression rather than a parameter. | |
echo "${a:b=$(b=${a%${a##*(a)}}; echo ${#b}),b:$(c=${a%%*(c)}; echo ${#c})-b}" | |
# Equivalent to any of: | |
# tmp="${a##*(a)}"; echo "${tmp%%*(c)}" |
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
[Background] | |
Bold=false | |
Color=0,0,0 | |
[BackgroundIntense] | |
Bold=false | |
Color=104,104,104 | |
[Color0] | |
Bold=false |
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
a: 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1=16 2=14 | |
b: 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 2 1 2 1 2 1 2 1 2 1 2 1 2 1=14 2=16 | |
c: 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1=15 2=15 | |
d: 2 1 1 2 1 2 1 1 2 1 2 1 2 1 1 2 1 1 2 1 2 1 1 2 1 2 1 1 2 1 1=18 2=12 | |
e: 3 2 3 2 3 2 3 2 3 2 3 2 3 3 2 3 2 3 2 3 2 3 2 3 2 3 2 3 3 2 2=14 3=16 | |
f: 2 2 1 2 1 2 1 2 1 2 2 1 2 1 2 1 1 2 1 2 1 2 2 1 2 1 2 1 2 1 1=14 2=16 |
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 | |
set -x | |
f() { | |
echo 'hi' | |
} >&${1} | |
{ f 3; cat; } <<<'' 3>/dev/stdin |
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
reverse() { | |
set -- "$@" "${2}[*]" | |
local -a 'keys=("${!'"$1"'[@]}")' | |
local -a "$2"=$'([${keys[n++]}]\'="${'"$1"$'[keys[\'{'$((${#keys[@]}-1))$'..0}\']]}"\')' # Generate elements | |
local -a "$2"=$'(\''"${!3}"$'\')' #Concatenate elements | |
local -a "$2"'=('"${!3}"')' #Build array | |
declare -p "$1" "$2"; | |
} | |
fromArr=(4 [2]=3 5 6 [11]='9 10' 14 [15]=$'15[ -6'); |