Mike Frysinger | e05f928 | 2009-04-09 23:01:47 +0000 | [diff] [blame] | 1 | unset var |
| 2 | |
Denis Vlasenko | 75bccfa | 2009-04-10 23:48:03 +0000 | [diff] [blame^] | 3 | echo Empty:${var#} |
| 4 | echo Empty:${var##} |
| 5 | echo Empty:${var#*} |
| 6 | echo Empty:${var##*} |
| 7 | echo Empty:${var%} |
| 8 | echo Empty:${var%%} |
| 9 | echo Empty:${var%*} |
| 10 | echo Empty:${var%%*} |
Mike Frysinger | e05f928 | 2009-04-09 23:01:47 +0000 | [diff] [blame] | 11 | |
| 12 | var= |
| 13 | |
Denis Vlasenko | 75bccfa | 2009-04-10 23:48:03 +0000 | [diff] [blame^] | 14 | echo Empty:${var#} |
| 15 | echo Empty:${var##} |
| 16 | echo Empty:${var#*} |
| 17 | echo Empty:${var##*} |
| 18 | echo Empty:${var%} |
| 19 | echo Empty:${var%%} |
| 20 | echo Empty:${var%*} |
| 21 | echo Empty:${var%%*} |
Mike Frysinger | e05f928 | 2009-04-09 23:01:47 +0000 | [diff] [blame] | 22 | |
Mike Frysinger | a4f331d | 2009-04-07 06:03:22 +0000 | [diff] [blame] | 23 | var=ababcdcd |
| 24 | |
| 25 | echo ${var#ab} |
| 26 | echo ${var##ab} |
| 27 | echo ${var#a*b} |
| 28 | echo ${var##a*b} |
| 29 | echo ${var#?} |
| 30 | echo ${var##?} |
| 31 | echo ${var#*} |
Denis Vlasenko | 75bccfa | 2009-04-10 23:48:03 +0000 | [diff] [blame^] | 32 | echo Empty:${var##*} |
Mike Frysinger | a4f331d | 2009-04-07 06:03:22 +0000 | [diff] [blame] | 33 | |
| 34 | echo ${var%cd} |
| 35 | echo ${var%%cd} |
| 36 | echo ${var%c*d} |
| 37 | echo ${var%%c*d} |
| 38 | echo ${var%?} |
| 39 | echo ${var%%?} |
| 40 | echo ${var%*} |
Denis Vlasenko | 75bccfa | 2009-04-10 23:48:03 +0000 | [diff] [blame^] | 41 | echo Empty:${var%%*} |
Mike Frysinger | a4f331d | 2009-04-07 06:03:22 +0000 | [diff] [blame] | 42 | |
| 43 | echo end |