Compare commits
3 Commits
1bb05ad1fc
...
2cf3906c4b
Author | SHA1 | Date | |
---|---|---|---|
2cf3906c4b | |||
f5fe72a2a1 | |||
1704ae6a5c |
14
phpsg.sh
14
phpsg.sh
@ -36,10 +36,10 @@ while getopts "o:s:j:h" opt
|
|||||||
do
|
do
|
||||||
case "$opt" in
|
case "$opt" in
|
||||||
o)
|
o)
|
||||||
OUTPUT_DIR="${OPTARG}"
|
OUTPUT_DIR="$(echo "${OPTARG}" | sed 's:/*$::')"
|
||||||
;;
|
;;
|
||||||
s)
|
s)
|
||||||
SOURCE_DIR="${OPTARG}"
|
SOURCE_DIR="$(echo "${OPTARG}" | sed 's:/*$::')"
|
||||||
;;
|
;;
|
||||||
j)
|
j)
|
||||||
JOBS="${OPTARG}"
|
JOBS="${OPTARG}"
|
||||||
@ -67,18 +67,18 @@ export SOURCE_DIR
|
|||||||
|
|
||||||
while IFS= read -r -d '' dir
|
while IFS= read -r -d '' dir
|
||||||
do
|
do
|
||||||
OUT_DIR="${OUTPUT_DIR}/${dir:${#SOURCE_DIR}}"
|
OUT_DIR="${OUTPUT_DIR}/${dir:((${#SOURCE_DIR} + 1))}"
|
||||||
if ! [ -d "$OUT_DIR" ]
|
if ! [ -d "$OUT_DIR" ]
|
||||||
then
|
then
|
||||||
mkdir -p "${OUTPUT_DIR}/${dir:${#SOURCE_DIR}}"
|
mkdir -p "$OUT_DIR"
|
||||||
fi
|
fi
|
||||||
done < <(find "$SOURCE_DIR" -mindepth 1 -type d -print0)
|
done < <(find "$SOURCE_DIR" -type d -print0)
|
||||||
|
|
||||||
function process_file() {
|
function process_file() {
|
||||||
file="$1"
|
file="$1"
|
||||||
if [[ $file = *.php ]]
|
if [[ $file = *.php ]]
|
||||||
then
|
then
|
||||||
DEST_FILE="${OUTPUT_DIR}/${file:${#SOURCE_DIR}:-4}"
|
DEST_FILE="${OUTPUT_DIR}/${file:((${#SOURCE_DIR} + 1)):-4}"
|
||||||
if ! [ "$file" -nt "$DEST_FILE" ]
|
if ! [ "$file" -nt "$DEST_FILE" ]
|
||||||
then
|
then
|
||||||
return
|
return
|
||||||
@ -87,7 +87,7 @@ function process_file() {
|
|||||||
php "$file" > "$DEST_FILE"
|
php "$file" > "$DEST_FILE"
|
||||||
echo "done"
|
echo "done"
|
||||||
else
|
else
|
||||||
DEST_FILE="${OUTPUT_DIR}/${file:${#SOURCE_DIR}}"
|
DEST_FILE="${OUTPUT_DIR}/${file:((${#SOURCE_DIR} + 1))}"
|
||||||
if ! [ "$file" -nt "$DEST_FILE" ]
|
if ! [ "$file" -nt "$DEST_FILE" ]
|
||||||
then
|
then
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user