Find the answer to your Linux question:
Results 1 to 3 of 3
Im having problems using a bash script i can get the script to start up and run but im not sure what the commands are from looking at the source ...
  1. #1
    Just Joined!
    Join Date
    Dec 2004
    Posts
    1

    Problems Using A Bash Script ??



    Im having problems using a bash script i can get the script to start up and run but im not sure what the commands are from looking at the source of the code its somthing really silly and to do with [local period dest message]

    Code:
    #!/bin/sh
    
    # A name for the script
    NAME="[msg]"
    
    . ./common.sh
    
    msg () {
        local period dest message
    
        echo "Period (in seconds) ?" 1>&2
        read period
        echo "Destination (nick or channel) ?" 1>&2
        read dest
        echo "Enter your message (one line) :" 1>&2
        read message
    
        init
        while true
          do
          echo "privmsg $dest :$message"
          xsleep $period
        done
    }
    
    msg | telnet $HOST $DEST
    does any one know what [local period dest message] means and how would it be used in term of command many thanks.

    **MOD_EDIT: added 'code' tags

  2. #2
    Linux Engineer
    Join Date
    Sep 2003
    Location
    Knoxhell, TN
    Posts
    1,078
    When posting source, scripts, error messages, config files, etc., please use the 'code' tags to make it more easily readable and distinguishable from the surrounding text.

    Thank You.
    Their code will be beautiful, even if their desks are buried in 3 feet of crap. - esr

  3. #3
    Just Joined!
    Join Date
    Dec 2004
    Location
    Beijing, China
    Posts
    4
    local is used to declare variables local to self-defined functions

Posting Permissions

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