#!/bin/bash

if [ $# -eq 0 ]; then
  while  read LINE ; do
    MSG="$MSG""^M""$LINE"
  done
else
  MSG=$*
fi

# This echo added to demonstrate that the script works
# it is not included in the book, as it's a code fragment
echo $MSG
