diff options
| author | srdusr <trevorgray@srdusr.com> | 2023-01-05 22:48:16 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2023-01-05 22:48:16 +0200 |
| commit | 1b5a0c56b27c6973c9f336b0827b0d565a1784e2 (patch) | |
| tree | d07978146dced4343ded6050d8c90eb3c6cc081f | |
| parent | a0d80471f776732e52cdfe32c30f135081f6517f (diff) | |
| download | dotfiles-1b5a0c56b27c6973c9f336b0827b0d565a1784e2.tar.gz dotfiles-1b5a0c56b27c6973c9f336b0827b0d565a1784e2.zip | |
Aliases to print output of a command into a file
| -rw-r--r-- | .config/zsh/.zshrc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 9b92422..65c10c8 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -378,6 +378,16 @@ alias trash_restore='gio trash --restore "$(gio trash --list | fzf | cut -f 1)"' alias ec='$EDITOR $HOME/.config/zsh/.zshrc' alias sc="source $HOME/.config/zsh/.zshrc" +# Print previous command into a file +getlast () { + fc -nl $((HISTCMD - 1)) +} + +alias pp='getlast 2>&1 |&tee -a output.txt' + +# Print output of a command NOTE: Must be used in conjunction but no need for "|" symbol +alias -g cap='2>&1 | tee -a output.txt' + # confirmation # alias mv='mv -i' alias cp='cp -i' |
