yes, that is correct, the 1 isn't part of the argument list.
This redirects all output to channel 1 (standard output) to /dev/null, which is some sort of black hole device. It trashes the grep ouput, so you don't see it at the console. You may omit the "1", because it's the default.
Code:
if tty | grep "pts" 1> /dev/null; then
In this case, I pass the ouput of "tty" to "grep", ouput is trashed to /dev/null. If the "grep" exits with an exit-code indicating 'success'; ie. the pattern was found, "if" will continue with the first block.
Code:
if [ "`tty | cut -c 0-3`" -eq "tty" ]; then
# it can be re-written as:
if test "`tty | cut -c 0-3`" -eq "tty" ; then
...notice the [square blacklets] here. I forgot them
This statement is even more complex. The backticks (` ... `) are used to execute one command inside another. The result will be inserted in the orginal command line.
If you want to understand how backtick trick works, try these commands:
Code:
date
echo "Hello"
echo "Hello, it's `date` now!"
hope this helps
it's quite little technical imho, but I hope you can understand it