Hi, first time posting here. I'm trying to write a simple script which automates the action of rendering a map of my Minecraft server, and saving the image to a directory, along with a scaled down copy of that image. I have programs (c10t for the mapping and ImageMagick for the scaling) to do both functions, but I can't get the script to work properly.
I need to include the time in the file name as the script is to be run automatically every X minutes. I have no problem getting the date, but when I try to append it into the file path (see code), I get extra newlines at the end, resulting in .png\n files, and Map-xxxx\n.png\n files. When I put all of the commands into a terminal window separately, everything works fine, and I am super confused by this. I'm clearly making some kind of error with the way I include the variables, but I've tried all sorts of formats with various sub-shells to no avail. Any Advice?
Code:
#!/bin/sh
DATE=$(date +%Y%m%d%H%M%S)
LARGE="/Library/WebServer/Documents/Maps/Large/Map-$DATE.png" #Directory of the large images
SMALL="/Library/WebServer/Documents/Maps/Small/Map-$DATE.png" #Directory for the thumbnails
MAP="/Users/XXXXXX/Documents/McMyAdmin/TranquilityBase" #Target for the mapping software
c10t -w $MAP -o $LARGE -m 2 -M 256 -y -r 270 #invokes the mapper with various paramaeters
convert -resize 6% $LARGE $SMALL #makes a low res copy to $SMALL