mirror of
https://github.com/onceupon/Bash-Oneliner.git
synced 2024-11-22 12:57:01 +00:00
add commands for 'others' section
bash auto-complete, fc
This commit is contained in:
parent
895c9dab1f
commit
88c21b27d6
15
README.md
15
README.md
@ -2189,6 +2189,15 @@ hostnamectl set-hostname "mynode"
|
|||||||
## Others
|
## Others
|
||||||
[[back to top](#handy-bash-one-liners)]
|
[[back to top](#handy-bash-one-liners)]
|
||||||
|
|
||||||
|
##### Bash auto-complete (e.g. show options "now tomorrow never" when you press'tab' after typing "dothis")
|
||||||
|
[Detailed tutoral](https://iridakos.com/tutorials/2018/03/01/bash-programmable-completion-tutorial.html)
|
||||||
|
```bash
|
||||||
|
complete -W "now tomorrow never" dothis
|
||||||
|
# ~$ dothis
|
||||||
|
# never now tomorrow
|
||||||
|
# press 'tab' again to auto-complete after typing 'n' or 't'
|
||||||
|
```
|
||||||
|
|
||||||
##### Repeat printing string n times (e.g. print 'hello world' five times)
|
##### Repeat printing string n times (e.g. print 'hello world' five times)
|
||||||
```bash
|
```bash
|
||||||
printf 'hello world\n%.0s' {1..5}
|
printf 'hello world\n%.0s' {1..5}
|
||||||
@ -2360,6 +2369,12 @@ speaker-test -t sine -f 1000 -l1
|
|||||||
history -d [line_number]
|
history -d [line_number]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
##### Interacting with history
|
||||||
|
```bash
|
||||||
|
# list 5 previous command (similar to `history |tail -n 5` but wont print the history command itself)
|
||||||
|
fc -l -5
|
||||||
|
```
|
||||||
|
|
||||||
##### Get last history/record filename
|
##### Get last history/record filename
|
||||||
```bash
|
```bash
|
||||||
head !$
|
head !$
|
||||||
|
Loading…
Reference in New Issue
Block a user