parent directory example

This commit is contained in:
zhumengu 2020-03-14 15:08:20 +08:00
parent b5cd93a09f
commit ef9f00aa5c
1 changed files with 2 additions and 1 deletions

View File

@ -138,6 +138,7 @@ See: [Parameter expansion](http://wiki.bash-hackers.org/syntax/pe)
STR="/path/to/foo.cpp"
echo ${STR%.cpp} # /path/to/foo
echo ${STR%.cpp}.o # /path/to/foo.o
echo ${STR%/*} # /path/to
echo ${STR##*.} # cpp (extension)
echo ${STR##*/} # foo.cpp (basepath)
@ -563,7 +564,7 @@ History
### Operations
| `!!` | Execute last command again |
| `!!` | Execute last command again |
| `!!: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 |
| `!$:t` | Expand only basename from last parameter of most recent command |