Merge pull request #619 from mhienle/patch-1

Fix typos
This commit is contained in:
Rico Sta. Cruz 2018-07-21 11:02:46 +08:00 committed by GitHub
commit ae7aec762c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -119,15 +119,15 @@ Parameter expansions
name="John"
echo ${name}
echo ${name/J/j} #=> "john" (substitution)
echo ${name:0:2} #=> "jo" (slicing)
echo ${name::2} #=> "jo" (slicing)
echo ${name::-1} #=> "joh" (slicing)
echo ${name:0:2} #=> "Jo" (slicing)
echo ${name::2} #=> "Jo" (slicing)
echo ${name::-1} #=> "Joh" (slicing)
echo ${food:-Cake} #=> $food or "Cake"
```
```bash
length=2
echo ${name:0:length} #=> "jo"
echo ${name:0:length} #=> "Jo"
```
See: [Parameter expansion](http://wiki.bash-hackers.org/syntax/pe)