-
-
Save little-forest/56593b7ceb55ae52e3142fc921d8144d to your computer and use it in GitHub Desktop.
simple compile script
This file contains hidden or 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 | |
| SRC=$1 | |
| if [[ ! "$SRC" ]]; then | |
| echo "第1引数にソースコードのファイル名を指定してください." >&2 | |
| exit 1 | |
| fi | |
| if [[ ! -f "$SRC" ]]; then | |
| echo "指定されたファイルが存在しません. : $SRC" >&2 | |
| exit 1 | |
| fi | |
| OBJDIR=~/bin | |
| if [[ ! -d "$OBJDIR" ]]; then | |
| echo "出力先ディレクトリが存在しません. : $OBJDIR" >&2 | |
| exit 1 | |
| fi | |
| OBJ=`basename "$SRC"` | |
| OBJ=${OBJ%.*} | |
| shift | |
| gcc -o "$OBJDIR/$OBJ" "$SRC" && "$OBJDIR/$OBJ" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment