$MYSTR ="node=slave-01:2.05:1.25:1.00"$ time tmp=${mystr%%:*}; echo ${tmp##*=}real 0m0.000suser 0m0.000ssys 0m0.000sslave-
${string#*pattern} minimizes matching pattern from the left and deletes (starting from the left) the first pattern and its left string
${string##*pattern} maximizes match pattern from the left and deletes (starting from the left) the last pattern and its left string
${string%pattern*} minimize match pattern from the right and delete (starting from the right) the first pattern and the string to the right (from the back forward)
${string%%pattern**} maximizes match pattern from the right and deletes (starting from the right) the last pattern and the string to the right (from the back forward)
#是去掉左边
% is to remove right
Single minimum match, two maximum matches
echo ${mystr:0:5}node=echo ${mystr:5:5 }slave
${string:start:length} (0 start count)
Contains the first start element, taking the element (START+LENGTH-1)
$echo ${mystr/:/_}node=slave-01_2. to:1.25:1.00echo ${mystr//:/_}node=slave-01_2.05 _1.25_1. xx
${string/old/new} replaces the first old with the new one
${string//old/new} Replaces all old with new
Old contains/time with \ Escape
Linux Shell string Cutting built-in method