Merge pull request #1383 from zhumengu/master
This commit is contained in:
commit
ae18baa7e9
5
bash.md
5
bash.md
|
@ -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 |
|
||||||
|
|
Loading…
Reference in New Issue