#!/bin/sh ## System V echo and BSD echo differ, especially if you want to print ## a line without a carriage return. ## In System V use: echo "text ... text\c" ## In BSD use: echo -n "text ... text" ## One way around this problem is to test which version you have and ## adjust each text string accordingly. TEXT="text1 ... text1" if [ "`echo -n`" = "-n" ]; then ## echo is a System V echo echo "$TEXT\c" else ## echo is a BSD echo echo -n "$TEXT" fi ## Another way around this problem is to test which version you have ## once and set environment variables accordingly. TEXT="text2 ... text2" if [ "`echo -n`" = "-n" ]; then ## echo is a System V echo ECHOOPT="" ECHOSUFF="\c" else ## echo is a BSD echo ECHOOPT="-n" ECHOSUFF="" fi echo $ECHOOPT "$TEXT$ECHOSUFF"