What does '2' and '&' mean in Bash?

15

I'm starting to study Bash and while analyzing some code in Github, I came across the following excerpts to create a theme:

which rbenv &> /dev/null || return
$(node -v 2> /dev/null)
    
asked by anonymous 02.03.2015 / 15:33

1 answer

14
which rbenv &> /dev/null || return
$(node -v 2> /dev/null)

which gets the path of rbenv and redirects stdout and stderr for /dev/null with &> , or || returns execution of node -v and redirects to < in> stderr , 2> .

Where:

02.03.2015 / 15:42