0

This is excerpted from ~/.bashrc on a RasPi.

if [ -z "${SSH_TTY}" ]; then
  startx > /dev/null 2>&1 
fi

I'm fairly sure the if statement means not for ssh tty sessions ie when establishing a remote console.

Obviously it starts x-windows and discards console output, but what does 2>&1 mean?

The ampersand probably means it forks, but what are the numbers? And what are some keywords for next time I need to read up on this?

5
  • I think this is a better answer (but on a closed question); see also What are the shell's control and redirection operators?. – Michael Homer May 1 '19 at 3:44
  • All three of the answers address that. I prefer the question of the answer I linked above as a duplicate, but it's closed (as a duplicate of the other one). – Michael Homer May 1 '19 at 3:54
  • @MichaelHomer Why don't you present your better answer comment as an answer? "The numbers are modifiers for the redirection and you can find details in this answer..." My problem was not knowing what to look for ... now that I know they are modifiers for the redirection I can RTFM! – Peter Wone May 1 '19 at 3:54
  • @MichaelHomer Look never mind, you've been very helpful even if I initially was taken aback. Thank you. – Peter Wone May 1 '19 at 3:57
  • I've added the other duplicate and made it the first one listed since it is a better question and answer. I don't like marking things duplicates of closed questions generally, but it does fit better here. – Michael Homer May 1 '19 at 4:00

Browse other questions tagged or ask your own question.