Follow

shell redirection:

>: STDOUT, overwrite
>>: STDOUT, append
2>: STDERR, overwrite
2>>: STDERR, append
&>: STDOUT/STDERR, overwrite
&>>: STDOUT/STDERR, append
<: read file to STDIN
<<: read multiline string to STDIN (heredoc)
<<<: read single line string to STDIN

@atoponce

# echo a b c d

!$ — last argument: d
!* — all arguments: a b c d
!:1 — the first argument
!^ — as above
!:1-3 — a b c
!:2-$ — b c d
!:0 — the last command executed (echo)

@xy In ZSH, there is one difference from Bash:

% echo a b c d
% echo $:2-$
b c

@atoponce alright... forgot about "!!" (repeat previous command incl. its arguments)

@atoponce 2>&1: redirect STDERR to whatever STDOUT is

@atoponce thank you very much. It is a valuable knowledge to me.

Sign in to participate in the conversation
Fosstodon

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.