exit 1
fi
-if [[ ! -x $(which libreoffice) ]] ; then
- echo "Cannot find executable libreoffice"
+echo "platform est $platform"
+
+case $platform in
+ Linux) libreoffice="libreoffice" ;;
+ CYGWIN*) libreoffice="soffice" ;;
+ *) print "Unkown platform $platform"
+ exit 1;;
+esac
+
+if [[ ! -x $(which "$libreoffice") ]] ; then
+ echo "Cannot find libreoffice executable"
+ echo "Make sure it is installed and the PATH variable includes its path"
exit 1
fi
while [ "$#" -gt 0 ]; do
- echo "Processing parameter: $1"
+ echo "Processing $1"
if [[ ! -f "$1" ]] || [[ ! -r "$1" ]] ; then
echo "$1 is not a readable file"
echo "${1%.docx}.txt already exists: skipping conversion"
else
- libreoffice --convert-to txt "$1"
+ $libreoffice --convert-to txt "$1"
if [[ ! -f "${1%.docx}.txt" ]] || [[ ! -r "${1%.docx}.txt" ]] ; then
echo "libreoffice did not create ${1%.docx}.txt"