Merge pull request #1383 from zhumengu/master

This commit is contained in:
Rico Sta. Cruz 2020-06-14 23:55:27 +10:00 committed by GitHub
commit ae18baa7e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 10 deletions

View File

@ -138,6 +138,7 @@ See: [Parameter expansion](http://wiki.bash-hackers.org/syntax/pe)
STR="/path/to/foo.cpp" STR="/path/to/foo.cpp"
echo ${STR%.cpp} # /path/to/foo echo ${STR%.cpp} # /path/to/foo
echo ${STR%.cpp}.o # /path/to/foo.o echo ${STR%.cpp}.o # /path/to/foo.o
echo ${STR%/*} # /path/to
echo ${STR##*.} # cpp (extension) echo ${STR##*.} # cpp (extension)
echo ${STR##*/} # foo.cpp (basepath) echo ${STR##*/} # foo.cpp (basepath)
@ -571,6 +572,8 @@ History
### Operations ### Operations
| Code | Description |
| -------------------- | --------------------------------------------------------------------- |
| `!!` | Execute last command again | | `!!` | Execute last command again |
| `!!:s/<FROM>/<TO>/` | Replace first occurrence of `<FROM>` to `<TO>` in most recent command | | `!!:s/<FROM>/<TO>/` | Replace first occurrence of `<FROM>` to `<TO>` in most recent command |
| `!!:gs/<FROM>/<TO>/` | Replace all occurrences of `<FROM>` to `<TO>` in most recent command | | `!!:gs/<FROM>/<TO>/` | Replace all occurrences of `<FROM>` to `<TO>` in most recent command |
@ -581,6 +584,8 @@ History
### Slices ### Slices
| Code | Description |
| -------- | ---------------------------------------------------------------------------------------- |
| `!!:n` | Expand only `n`th token from most recent command (command is `0`; first argument is `1`) | | `!!:n` | Expand only `n`th token from most recent command (command is `0`; first argument is `1`) |
| `!^` | Expand first argument from most recent command | | `!^` | Expand first argument from most recent command |
| `!$` | Expand last token from most recent command | | `!$` | Expand last token from most recent command |