Looking for
David Korn, KSH - A Shell Programming Language
from:
PPN: 303892498
# Nr. 1 | |
p='port: 5432,' | |
echo ${p//[!0-9]/} | |
# Nr. 2 | |
IFS=':, ' read -r _ p <<< "port: 5432," | |
# Nr. 3 | |
awk -F[,:] '{print $2+0}' <<< "port: 5432," |
unset -v x y r | |
x=5 y=2 r="$x*$y*2" \ | |
declare -x +x -i r; | |
declare -p x y r |
# execute it with source | |
unalias tail | |
echo 1 > /tmp/TEST_LOG; | |
sleep 100 & | |
pid_bg=$! | |
i=0 | |
while |
#!/usr/bin/env bash | |
AssocTest () | |
{ | |
create1 () | |
{ | |
declare -g -A Assoc | |
declare i | |
for ((i=${1?}; i <= ${2?}; i++)) |
% time for ((i=0; i < 1000; i++)); do \bash -c ':;:' ; done | |
real 0m4.710s | |
user 0m0.444s | |
sys 0m1.420s | |
% time for ((i=0; i < 1000; i++)); do \dash -c ':;:' ; done | |
real 0m3.047s | |
user 0m0.080s |
% printf 'echo dylan?;' \; >/tmp/prize; for i in {0..32767}; do printf ':;'; done >> /tmp/prize | |
% stat /tmp/prize | |
File: '/tmp/prize' | |
Size: 65548 Blocks: 136 IO Block: 4096 regular file | |
Device: 801h/2049d Inode: 12320778 Links: 1 | |
Access: (0640/-rw-r-----) Uid: ( 1000/ user1) Gid: ( 1000/ user1) | |
Access: 2016-11-02 13:42:52.864527834 +0000 | |
Modify: 2016-11-02 13:46:12.501955930 +0000 | |
Change: 2016-11-02 13:46:12.501955930 +0000 | |
Birth: - |
#!/usr/bin/env bash | |
# | |
# No local scope, use command substitution, process | |
# substitution, regular pipes or execute external procedures/scripts. | |
# | |
# Use set -o allexport, if you like to be oldschool. | |
#mapfile -t -c 1 -C "printf '%.0s%s\n'" -u 7 "${FUNCNAME[1]%%.*}" | |
function fn.call { |
Looking for
David Korn, KSH - A Shell Programming Language
from:
PPN: 303892498
#!/usr/bin/env bash | |
function setup { | |
typeset -g "$1" 2>/dev/null && { | |
typeset -n fd=$1; | |
((${!fd})) && | |
exec {fd}>&-; | |
exec {fd}> >('handler'); | |
}; | |
}; |
#!/bin/sh | |
get_path () { | |
command -v "$1"; | |
}; | |
has_operator () { | |
case "$1" in | |
(*";"*|*"&"*|*"&&"*|*"||"*|*";;"*|*"("*|*")"*) | |
command \return 1;; |