Bash: Difference between revisions

From DWIKI
mNo edit summary
Line 12: Line 12:
  FIRST=${STRING:0:1}
  FIRST=${STRING:0:1}


==check if var contains substring
  test "${s#*foo}" != "${s}"


==move cursor==
==move cursor==

Revision as of 09:24, 7 April 2017

Tips and tricks

get first character of a string

FIRST=${STRING:0:1}

==check if var contains substring

 test "${s#*foo}" != "${s}"

move cursor

^b move back 1 char
^f move forward 1 char
alt-b move back 1 word
alf-f move forward 1 word