Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2004
    Posts
    7

    Question Unanswered: Sending message in UnixScript

    Hi Frinz,
    I want to send some message to some of my friends who have logged in at that time.I am using "write" command to do this in my script but what happening is some of the id which I am sending message has been logged in at more than one places because of this the command next to this command is not executing.

    Below are the command I am using:

    Notification_List="id1 id2 id3"

    for write_List in $Notification_List
    do
    write $write_List << Message
    Just for test
    Good Morning
    Message
    echo "Message has been sent"

    when executing this command it is saying

    id2 is logged on more than one place.
    You are connected to "pts/2".
    Other locations are:
    pts/10

    and waiting there without terminating after execution.

    Can any one tell the reason for this and any way to solve this.

    It will be great if any one help me in this regards.

    - kmrs

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    try removing the space in '<< Message'

    make it:

    write $write_List <<Message

  3. #3
    Join Date
    Dec 2003
    Posts
    56
    The problem is quite simple. As you mention you get the error:

    id2 is logged on more than one place.
    You are connected to "pts/2".
    Other locations are:
    pts/10
    It is telling you that id2 has two sessions open and the write command doesn't know which of the two to write to.

    man write will tell you what to add to the write command to send it to a certain sessions (either pts/2 or pts/10 in your example.

    Another way to solve it is to make sure you only have one session open....but I guess in this case you want 2 sessions to see the write....

  4. #4
    Join Date
    Oct 2003
    Posts
    9
    Quote Originally Posted by TimoV
    It is telling you that id2 has two sessions open and the write command doesn't know which of the two to write to.
    write warns about multiple coonnections, but it will send to the first occurence in /etc/utmp.

  5. #5
    Join Date
    Oct 2004
    Posts
    7
    Hi Frenz,

    Thank you yar.

    - kmrs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •