2016-10-02 18:08:04 +02:00
|
|
|
unset var
|
|
|
|
|
|
|
|
echo Empty:${var#}
|
|
|
|
echo Empty:${var##}
|
|
|
|
echo Empty:${var#*}
|
|
|
|
echo Empty:${var##*}
|
|
|
|
echo Empty:${var%}
|
|
|
|
echo Empty:${var%%}
|
|
|
|
echo Empty:${var%*}
|
|
|
|
echo Empty:${var%%*}
|
|
|
|
|
|
|
|
var=
|
|
|
|
|
|
|
|
echo Empty:${var#}
|
|
|
|
echo Empty:${var##}
|
|
|
|
echo Empty:${var#*}
|
|
|
|
echo Empty:${var##*}
|
|
|
|
echo Empty:${var%}
|
|
|
|
echo Empty:${var%%}
|
|
|
|
echo Empty:${var%*}
|
|
|
|
echo Empty:${var%%*}
|
|
|
|
|
2008-04-12 22:55:33 +00:00
|
|
|
var=ababcdcd
|
|
|
|
|
|
|
|
echo ${var#ab}
|
|
|
|
echo ${var##ab}
|
2008-04-12 23:02:43 +00:00
|
|
|
echo ${var#a*b}
|
2008-04-12 22:55:33 +00:00
|
|
|
echo ${var##a*b}
|
|
|
|
echo ${var#?}
|
2008-04-12 23:02:43 +00:00
|
|
|
echo ${var##?}
|
|
|
|
echo ${var#*}
|
2016-10-02 18:08:04 +02:00
|
|
|
echo Empty:${var##*}
|
|
|
|
echo ${var#}}_tail
|
|
|
|
echo ${var#\}}_tail
|
2008-04-12 22:55:33 +00:00
|
|
|
|
|
|
|
echo ${var%cd}
|
|
|
|
echo ${var%%cd}
|
2008-04-12 23:02:43 +00:00
|
|
|
echo ${var%c*d}
|
2008-04-12 22:55:33 +00:00
|
|
|
echo ${var%%c*d}
|
|
|
|
echo ${var%?}
|
2008-04-12 23:02:43 +00:00
|
|
|
echo ${var%%?}
|
|
|
|
echo ${var%*}
|
2016-10-02 18:08:04 +02:00
|
|
|
echo Empty:${var%%*}
|
|
|
|
echo ${var#}}_tail
|
|
|
|
echo ${var#\}}_tail
|
|
|
|
echo ${var%\\*}
|
|
|
|
|
|
|
|
a=ab}; echo ${a%\}};
|
|
|
|
a=abc; c=c; echo ${a%${c}}
|
|
|
|
a=ab{{c; echo ${a%`echo {{c`}
|
2008-04-12 23:02:43 +00:00
|
|
|
|
2016-10-02 18:08:04 +02:00
|
|
|
echo End
|