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?. Commented May 1, 2019 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). Commented May 1, 2019 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! Commented May 1, 2019 at 3:54
  • @MichaelHomer Look never mind, you've been very helpful even if I initially was taken aback. Thank you. Commented May 1, 2019 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. Commented May 1, 2019 at 4:00

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.