Skip to content

Instantly share code, notes, and snippets.

@dpo
Created September 3, 2011 23:00
Show Gist options
  • Save dpo/1191912 to your computer and use it in GitHub Desktop.
Save dpo/1191912 to your computer and use it in GitHub Desktop.
Simple AMPL Decoding
#!/bin/sh
#
# This script helps save keystrokes when decoding AMPL models.
#
# "amplog name.mod" means "ampl -ogname name.mod"
# "amplog name2 name.mod" means "ampl -ogname2 name.mod"
# "amplog name2 name.mod name.dat" means "ampl -ogname2 name.mod name.dat"
#
dat=
if (( $# == 1 )); then
mod=$1
nl=`basename $1 .mod`
elif (( $# >= 2 )); then
nl=`basename $1 .nl`
mod=$2
fi
(( $# >= 3 )) && dat=$3
ampl -og${nl} ${mod} ${dat}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment