Skip to content

Instantly share code, notes, and snippets.

@locks
Created March 3, 2009 21:25
Show Gist options
  • Save locks/73533 to your computer and use it in GitHub Desktop.
Save locks/73533 to your computer and use it in GitHub Desktop.
LPROG, lazy scripts O:-)
#!/bin/bash
function runFlex {
echo $ficheiro
flex="$ficheiro.c"
gcc="$ficheiro.out"
flex -o $flex $ficheiro
gcc -o $gcc $flex -lfl
./$gcc
rm $flex
rm $gcc
}
function help {
version
echo
echo Usage:
echo " reflex <arg> [file name]"
echo
echo Other commands:
echo " -h Print this help message."
echo " -v Print version information."
}
function version {
echo
echo "reflex script (r090312)"
echo " by locks"
echo
}
ficheiro="$1"
if [ -z "$ficheiro" ]; then
help
exit
else
if [ -f "$ficheiro" ]; then
runFlex
echo Concluído com êxito.
exit
fi
if [ "$ficheiro" = "-h" ]; then
help
exit
fi
if [ "$ficheiro" = "-v" ]; then
version
exit
fi
fi
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment