Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View laggardkernel's full-sized avatar

laggardkernel laggardkernel

View GitHub Profile
@laggardkernel
laggardkernel / pitfall-of-while-read-in-bash.bash
Created June 18, 2019 05:31
pitfall of while read #bash
# A background process started within a loop may compete with
# the loop for stdin, which causes the `while read` loop stop
# after the 1st round.
cat << EOF >| tasklist.txt
1
2
3
EOF
@laggardkernel
laggardkernel / whether-a-command-exists.md
Last active October 16, 2019 13:58
determine whether a command exists in zsh

Determine Whether a Command Exists in ZSH

The main purpose is to determine whether a command exists in PATH. Some of the following methods also support determine the existence of functions. The comparison focuses on speed, not support coverage.

export TIMEFMT=$'%U user %S system %P cpu %*E total'time (for i ({1..100}) if (($+commands[tree])); then echo 1 &>/dev/null; fi)
@laggardkernel
laggardkernel / startup-time-of-zsh.md
Last active April 12, 2024 13:24
Comparison of ZSH frameworks and plugin managers

Comparison of ZSH frameworks and plugin managers

Changelog

  • update 1: add a FAQ section
  • update 2: benchmark chart and feature comparison table
  • update 3:
    • improve the table with missing features for antigen
    • new zplg times result

TLDR