Scripts

Sample scripts for running Writeup

Compiling on a Mac

Bash Script for running Writeup

#!/bin/bash
# script to compile writeup file from $command variable
# uncomment *one* of the two following lines. a) run from command line b) run within gedit
#file=$1
file=$GEDIT_CURRENT_DOCUMENT_NAME

ext=${file: -4}
if [ "$ext" != ".txt" ]; then
  echo "Type" $ext "is not a Writeup file"
  exit 1
fi

command=`writeup -yqqx command $file`
if [ "$command" != "NOT_FOUND" ]; then eval $command
  if [ $? -ne 0 ]; then exit 1; fi
  echo COMMANDS COMPLETED SUCCESSFULLY
else
  wtype=`writeup -yqqx TYPE $file`
  if [ "$wtype" == "writeup" ]; then
    writeup -y $file
  else
    echo $file "is not a Writeup main document but of type:" $wtype
    exit 1
  fi
fi
Syndicate content