[PATCH v3 lkp-tests] sbin/set-env.sh: modify the method of adding env-variables

Signed-off-by: Hu XueJiao <1034502035@qq.com> --- sbin/set-env.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sbin/set-env.sh b/sbin/set-env.sh index a8b161fa..0b197afc 100644 --- a/sbin/set-env.sh +++ b/sbin/set-env.sh @@ -2,10 +2,17 @@ . lib/env.sh -write_shellrc() +write_shell_profile() { - echo "export LKP_SRC=$PWD" >> $(shell_profile) - echo "export PATH=\$PATH:\$LKP_SRC/sbin:\$LKP_SRC/bin" >> $(shell_profile) + shell_profile_file=$(shell_profile) + if [ $# -gt 0 ]; then + echo $@ >> $shell_profile_file + else + echo "export LKP_SRC=$PWD" >> $shell_profile_file + echo "export PATH=\$PATH:\$LKP_SRC/sbin:\$LKP_SRC/bin" >> $shell_profile_file + fi + + source $shell_profile_file } write_host() @@ -28,5 +35,5 @@ write_host() EOF } -write_shellrc +write_shell_profile write_host -- 2.23.0
participants (1)
-
Hu Xuejiao