Use local variables.

This commit is contained in:
Nicolás A. Ortega Froysa 2022-11-08 16:40:13 +01:00
parent 91b8b3b570
commit 74e2c1a3fd

View File

@ -128,9 +128,9 @@ function new_project()
{
echo "$PROJECT_NAME v$ISIDORE_VERSION"
NEW_PROJECT_DIR=$1
NEW_PROJECT_NAME="New Project"
NEW_PROJECT_URL="http://example.com/"
local NEW_PROJECT_DIR=$1
local NEW_PROJECT_NAME="New Project"
local NEW_PROJECT_URL="http://example.com/"
if [ $2 == 1 ]
then
echo -n "Project name: "
@ -177,7 +177,7 @@ function build_project()
{
check_in_project
CFG_HEADER_FILE="$TMP_DIR/config-header.php"
local CFG_HEADER_FILE="$TMP_DIR/config-header.php"
mkdir -p $OUTPUT_DIR
mkdir -p $TMP_DIR
@ -193,7 +193,7 @@ function build_project()
do
cat $CFG_HEADER_FILE $i > $TMP_DIR/$i
: ${i:${#SOURCE_DIR}}
OUT_FILE="$OUTPUT_DIR/${_: :-4}"
local OUT_FILE="$OUTPUT_DIR/${_: :-4}"
if [ $1 == 1 ]
then
echo "Building $OUT_FILE ..."
@ -203,7 +203,7 @@ function build_project()
for i in $(find $SOURCE_DIR -type f -not -name '*.php')
do
OUT_FILE="$OUTPUT_DIR/${i:${#SOURCE_DIR}}"
local OUT_FILE="$OUTPUT_DIR/${i:${#SOURCE_DIR}}"
if [ $1 == 1 ]
then
echo "Copying $OUT_FILE ..."