Question: Can someone help me write a simple bash script that handles the following usage:

```
./application channels;message

eg:  ./application channel1 channel2 channel3;this is a message

```

so basically anything before the delimiter ; is channels separated by a space, and anything after the ; is the message.

Basically, i wanted to store each of these into a variale and print them out...

Answer: 
You probably want to look for a other way to delimit the message, since a semicolon will result that bash will read up to the semicolon and "think hey this is the end of the command". Then bash will run you program with the arguments before the semicolon. Subsequently it will look for a program or build-in called 'this' and provide 'is', 'a' and 'message' as command line arguments to this. However bash will probably answer with 'this: command not found'.
For more information look up the meaning of the ';'/semicolon operator in the [bash manual](http://www.gnu.org/software/bash/manual).

what you might do is something like the following

```
#!/bin/bash

message=""
outfiles=""

# Loop until all parameters are used up
# shift "eats" one argument at a time
# util there are no arguments left then $1 is a emtpy string
while [ "$1" != "" ]; do

    if [ "$1" == "-m" ] # the message
    then
        shift #"eat one arugment then $1 is your message"
        #you should check if there is a argument after "-m"
        message=$1
    else
        outfiles="$outfiles $1"
    fi

    # Shift all the parameters down by one
    shift

done

# put the message it the other arguments specified.

for i in $outfiles; do
    echo $message > $i
done

```

what this program does is checks for "-m" then it will shift all argument so you have arguments minus once and write this message to the oter arguments eg
$./program.bash -m "Hello world" output1.txt ouput2.txt
this program put message "Hello world" into newly created or (be carefull) overwritten files output1.txt output2.txt
You can use the [cut](http://en.wikipedia.org/wiki/Cut_%28Unix%29) command: 

```
#!/bin/bash 
variables=`echo $* | cut -d';' -f1`
message=`echo $* | cut -d';' -f2`
echo "variables: " $variables
echo "message: " $message

```

Be sure to `\`-escape the semicolon:

```
$ ./application channels\;message
channels:  channels
message:  message

```