Created
March 3, 2009 21:25
-
-
Save locks/73533 to your computer and use it in GitHub Desktop.
LPROG, lazy scripts O:-)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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