Skip to content

Instantly share code, notes, and snippets.

@L-Soft
Created January 8, 2020 13:09
Show Gist options
  • Save L-Soft/617b568f9e0e0e8f03f74f383956da6d to your computer and use it in GitHub Desktop.
Save L-Soft/617b568f9e0e0e8f03f74f383956da6d to your computer and use it in GitHub Desktop.
#!/bin/bash
print_usage () {
echo "Usage: $0 filename lines"
exit 2
}
# 아규먼트가 없으면 종료된다.
if [ "$#" -eq 0 ]; then
print_usage
fi
# 폴더 유무 확인
if [ ! -d bin ]; then # 없으면 생성
mkdir bin
else # 있으면 삭제
rm -rf ./bin/*
fi
# 파일 있으면 삭제
if [ -f libSources.txt ]; then
rm -rf libSources.txt
fi
# 공통모듈 파일을 리스트 파일로 변경
find ./src/ -name "*.java" 2>/dev/null > libSources.txt
# $# argument count, $@ argument strings
# https://stackoverflow.com/questions/12711786/convert-command-line-arguments-into-an-array-in-bash
# 빌드하는 부분, 라이브러리 추가, 공통모듈 추가
# 실행하는 방법
# java -cp ".:/Users/cats-soft/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar" 실행파일
echo "$#, $@"
javac -d bin -cp /Users/cats-soft/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar -Xlint @libSources.txt $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment