Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
40 lines (32 sloc) 624 Bytes
title updated subtitle tags
2019-02-23 09:50:19 UTC
common shell notes
notes, bash

Line editing

Should work in bash and zsh, and in some readline environments.

^u # delete everything before the cursor
^k # delete everything after the cursor
^h # delete one character before the cursor
^d # delete character after the cursor
^w # delete from cursor to the start of previous word

Flow Control

If / else if / else

if [ "$foo" -eq 0 ]; then
  echo "true"
elif [ "$foo -gt 0 ]
  echo "false"
  echo "maybe"

For loop.

for f in ${SET}; do
  echo "${f}"
You can’t perform that action at this time.