[PATCH compass-ci] sparrow/3-code: fix no such file or directory

[Why] when run dev-env in centos system error like this: ./dev-env:line 41: ./os/centos: No such file or directory. Signed-off-by: Zhang Yale <zhangyale3@huawei.com> --- sparrow/3-code/dev-env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sparrow/3-code/dev-env b/sparrow/3-code/dev-env index 11c7fb0..7703786 100755 --- a/sparrow/3-code/dev-env +++ b/sparrow/3-code/dev-env @@ -38,4 +38,4 @@ EOF source /etc/os-release -. $(dirname ${BASH_SOURCE[0]})/os/${ID} +[ -f "${ID}" ] && . $(dirname ${BASH_SOURCE[0]})/os/${ID} -- 2.23.0

On Thu, Oct 29, 2020 at 05:24:12PM +0800, Zhang Yale wrote:
[Why] when run dev-env in centos system error like this: ./dev-env:line 41: ./os/centos: No such file or directory.
Signed-off-by: Zhang Yale <zhangyale3@huawei.com> --- sparrow/3-code/dev-env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sparrow/3-code/dev-env b/sparrow/3-code/dev-env index 11c7fb0..7703786 100755 --- a/sparrow/3-code/dev-env +++ b/sparrow/3-code/dev-env @@ -38,4 +38,4 @@ EOF
source /etc/os-release
-. $(dirname ${BASH_SOURCE[0]})/os/${ID} +[ -f "${ID}" ] && . $(dirname ${BASH_SOURCE[0]})/os/${ID}
when testing the file exists, please add the file's path, otherwise it will return non-0 value. Thanks Luan Shengde
-- 2.23.0

On Thu, Oct 29, 2020 at 05:54:18PM +0800, Luan Shengde wrote:
On Thu, Oct 29, 2020 at 05:24:12PM +0800, Zhang Yale wrote:
[Why] when run dev-env in centos system error like this: ./dev-env:line 41: ./os/centos: No such file or directory.
Signed-off-by: Zhang Yale <zhangyale3@huawei.com> --- sparrow/3-code/dev-env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sparrow/3-code/dev-env b/sparrow/3-code/dev-env index 11c7fb0..7703786 100755 --- a/sparrow/3-code/dev-env +++ b/sparrow/3-code/dev-env @@ -38,4 +38,4 @@ EOF
source /etc/os-release
-. $(dirname ${BASH_SOURCE[0]})/os/${ID} +[ -f "${ID}" ] && . $(dirname ${BASH_SOURCE[0]})/os/${ID}
when testing the file exists, please add the file's path, otherwise it will return non-0 value.
Thanks Luan Shengde
Ok, I got it. Thanks, Yale
-- 2.23.0

On Thu, Oct 29, 2020 at 05:24:12PM +0800, Zhang Yale wrote:
[Why] when run dev-env in centos system error like this: ./dev-env:line 41: ./os/centos: No such file or directory.
Signed-off-by: Zhang Yale <zhangyale3@huawei.com> --- sparrow/3-code/dev-env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sparrow/3-code/dev-env b/sparrow/3-code/dev-env index 11c7fb0..7703786 100755 --- a/sparrow/3-code/dev-env +++ b/sparrow/3-code/dev-env @@ -38,4 +38,4 @@ EOF
source /etc/os-release
-. $(dirname ${BASH_SOURCE[0]})/os/${ID}
you should show an comments about ID.
+[ -f "${ID}" ] && . $(dirname ${BASH_SOURCE[0]})/os/${ID}
perhaps you can replace like this: . $(dirname ${BASH_SOURCE[0]})/os/${ID} => source $(dirname ${BASH_SOURCE[0]})/os/${ID} Thanks, Liushaofei
-- 2.23.0

On Thu, Oct 29, 2020 at 07:05:34PM +0800, Liu Shaofei wrote:
On Thu, Oct 29, 2020 at 05:24:12PM +0800, Zhang Yale wrote:
[Why] when run dev-env in centos system error like this: ./dev-env:line 41: ./os/centos: No such file or directory.
Signed-off-by: Zhang Yale <zhangyale3@huawei.com> --- sparrow/3-code/dev-env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sparrow/3-code/dev-env b/sparrow/3-code/dev-env index 11c7fb0..7703786 100755 --- a/sparrow/3-code/dev-env +++ b/sparrow/3-code/dev-env @@ -38,4 +38,4 @@ EOF
source /etc/os-release
-. $(dirname ${BASH_SOURCE[0]})/os/${ID}
you should show an comments about ID.
Ok, got it.
+[ -f "${ID}" ] && . $(dirname ${BASH_SOURCE[0]})/os/${ID}
perhaps you can replace like this:
. $(dirname ${BASH_SOURCE[0]})/os/${ID} => source $(dirname ${BASH_SOURCE[0]})/os/${ID}
Thanks, Liushaofei
Good! Thanks, Yale
-- 2.23.0
participants (3)
-
Liu Shaofei
-
Luan Shengde
-
Zhang Yale