My whole task sounds like this Show how many users are working right now, whenever someone has logged out or has logged in, print the new amount of users. Create a new screen and print there text outcome. With the first part I've dealt with it pretty well. Here is the code: #!/bin/bashupdateusers(){    log=$( who | grep st | awk '{print $1}' | wc -l);}updateuserstemp=$logecho Now logged users: $lrnwhile truedo    updateusers    if [ $temp -lt $log ]; then        temp=$log        echo User has logged in : $log        fi    if [ $temp -gt $log ]; then        temp=$log        echo User has logged out: $log        fi    sleep 1doneThe second task is to create second screen inside the script and print text from this script to it. I've used screen -S name -p 0 -X stuff text here/echo command with text and echo text > screen -S name -p 0. None of that worked for me.
Sending a text from script to a screen
shell script;gnu screen