Made more Mac/BSD Friendly
Fixes small bug involving determining relative path
This commit is contained in:
parent
53905b58d5
commit
f32a0ac33b
@ -8,7 +8,7 @@ else
|
|||||||
FILES=("${@}")
|
FILES=("${@}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CUR_DIR=$(basename ${BASH_SOURCE[0]})
|
CUR_DIR=$(dirname ${BASH_SOURCE[0]})
|
||||||
|
|
||||||
for FILE in "${FILES[@]}"; do
|
for FILE in "${FILES[@]}"; do
|
||||||
if [ "${FILE}" == "-" ]; then
|
if [ "${FILE}" == "-" ]; then
|
||||||
@ -23,9 +23,9 @@ for FILE in "${FILES[@]}"; do
|
|||||||
|
|
||||||
#My SOURCE substitution
|
#My SOURCE substitution
|
||||||
if echo $LINE | grep -q ^SOURCE; then
|
if echo $LINE | grep -q ^SOURCE; then
|
||||||
SOURCE=$(echo "${LINE}" | sed -r 's|^SOURCE\s+(\S*)\s*|\1|')
|
SOURCE=$(echo "${LINE}" | sed -E 's|^SOURCE[ ]+(.*)|\1|')
|
||||||
if [ "${SOURCE:0:1}" != "/" ] && [ -f "${CUR_DIR}/${SOURCE}" ]; then
|
if [ "${SOURCE:0:1}" != "/" ] && [ -f "${CUR_DIR}/${SOURCE}" ]; then
|
||||||
SOURCE="${BASH_SOURCE[0]}" "${CUR_DIR}/${SOURCE}"
|
SOURCE="${CUR_DIR}/${SOURCE}"
|
||||||
fi
|
fi
|
||||||
if [ ! -f "${SOURCE}" ]; then
|
if [ ! -f "${SOURCE}" ]; then
|
||||||
echo "Could not find a readable ${SOURCE}" >& 2
|
echo "Could not find a readable ${SOURCE}" >& 2
|
||||||
@ -36,4 +36,4 @@ for FILE in "${FILES[@]}"; do
|
|||||||
echo "${LINE}"
|
echo "${LINE}"
|
||||||
fi
|
fi
|
||||||
done < ${FILE}
|
done < ${FILE}
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user