V
V
Viktor Yanyshev2017-09-19 12:56:19
linux
Viktor Yanyshev, 2017-09-19 12:56:19

Why can't you find functions in the included file?

Reports that line 75: getProjectPath: command not found , etc. where there is a function call.
The structure is:
~/build_script/build_dev - (chmod +x)
~/build_script/libs/
~/build_script/libs/dev.sh (chmod +x)
build_dev:

#!/bin/bash
. ./libs/dev.sh

getProjectPath $project

if [ "$test" = "true" ]
then
  cleanTmp
fi

dev.sh
function cleanTmp {
    echo "Удаляем результат сборки проекта"
    rm -Rf $BUILD_DIR/*
    rm -Rf $BUILD_DIR/.g*

    if [ $(ls -a "$BUILD_DIR" | wc -l) -eq 2 ]
    then
        echo -e "\e[32mCборка проекта: ${project} успешно удалена\e[0m"
    fi
}


function getProjectPath() {
    local name=$(echo $1 | tr [a-z] [A-Z])
    eval echo \${$name[path]}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2017-09-19
@villiwalla

how do you run build_dev? Being in the ~/build_script/ folder?
If not, then in line
. ./libs/dev.sh change
path to absolute

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question