I want to tell my script to upload to my website (this works fine) and to none, one or both media centers using a second parameter.
This is the relevant part of my script dealing with this:
Code: Select all
#/bin/bash
# Read command line arguments
if [ -z "$1" ]; then
echo "Please enter an existing file name as arg 1!"
echo "Usage:"
echo "putvideo <video filename> <target mediacenters>"
exit
else
FILENAME="$1"
if [ ! -f "$FILENAME" ]; then
echo "File $FILENAME not found!"
exit
fi
fi
if [ -z "$2" ]; then
kodiflag="$2"
else
kodiflag="0"
fi
....
#Now copy files to Kodi (only if flag is set)
if [ "$kodiflag" = "1" ] || [ "$kodiflag" = "3" ]; then
echo "Copy the video file to Kodi"
COMMAND="cp $FILENAME $KODIDISK/$DIRNAME/"
$COMMAND
fi
if [ "$kodiflag" = "2" ] || [ "$kodiflag" = "3" ]; then
echo "Copy to new Kodi too"
COMMAND="cp $FILENAME $KODIDISK2/$DIRNAME/"
$COMMAND
fi
Code: Select all
putvideo inputfile.mp4 1
Apparently the logic (assembled from reading posts via Google search) does not work but I don't know why...
Any ideas?