2>file
means "redirect what's written to file descriptor 2
to the file file
". File descriptor 2 is "standard error", the descriptor to which programs write error messages. 2>/dev/null
therefore silences error messages.
>file
is short for 1>file
. It means "redirect what's written to file descriptor 1
to the file file
". File descriptor 1 is "standard output", the descriptor to which programs write information messages. >/dev/null
therefore silences informational messages.
mktemp
writes error messages to stderr. 2>/dev/null
silences error messages.
mktemp
writes the generated file name to stdout. >/dev/null
silences that. (This makes the call to mktemp
rather useless!)
For example,
$ alias hello='perl -e'\''print STDOUT "Hello\n"; print STDERR "World\n";'\'''
$ hello
Hello
World
$ hello 2>/dev/null
Hello
$ hello >/dev/null
World
You might want to replace
temp=$( mktemp 2>/dev/null )
with
temp=$( mktemp ) || exit 1
to fail with a useful message rather than passing bad data to wget
(which will cause it to fail).