diff --git a/libytest.so b/libytest.so index 9deb47b..16c024f 100644 Binary files a/libytest.so and b/libytest.so differ diff --git a/set_env.sh b/set_env.sh index 6b8af45..7e384ba 100644 --- a/set_env.sh +++ b/set_env.sh @@ -1,20 +1,15 @@ #!/bin/bash -file_env=tempFILE -if [ -e "$file_env" ] ; then - rm "$file_env" -fi + if [ "$#" -le 0 ] ; then + echo "if need permanent config" echo "Usage: $0 file_name" >&2 echo "for example: $0 ~/.bashrc" >&2 - echo "or add these lines in bash profile for example: ~/.bashrc" + echo "or an other bash profile, here it is \"~/.bashrc\" for example" + export CPATH=$PWD/include_ytest/include:$CPATH + export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH else - file_env=$1 -fi -echo "export CPATH=$PWD/include_ytest/include:\$CPATH" >> $file_env -echo "export LD_LIBRARY_PATH=$PWD:\$LD_LIBRARY_PATH" >> $file_env - -if [ "$#" -le 0 ] ; then - cat $file_env - rm $file_env + echo "export CPATH=$PWD/include_ytest/include:\$CPATH" >> $1 + echo "export LD_LIBRARY_PATH=$PWD:\$LD_LIBRARY_PATH" >> $1 + source $1 fi diff --git a/unset_env.sh b/unset_env.sh index a9f0220..a67a61e 100644 --- a/unset_env.sh +++ b/unset_env.sh @@ -1,17 +1,11 @@ #!/bin/bash -file_env=tempFILE -if [ -e "$file_env" ] ; then - rm "$file_env" -fi if [ "$#" -le 0 ] ; then - echo "Usage: $0 file_name" >&2 + LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | sed "s@$PWD:@@g") + CPATH=$(echo $CPATH | sed "s@$PWD/include_ytest/include:@@g") + echo "If need permanent unset env " + echo "Usage: $0 file_name" echo "for example: $0 ~/.bashrc" >&2 - echo "or remove these lines in bash profile (for example: ~/.bashrc) th file you have set whith set_env.sh" - echo "export CPATH=$PWD/include_ytest/include:\$CPATH" >> $file_env - echo "export LD_LIBRARY_PATH=$PWD:\$LD_LIBRARY_PATH" >> $file_env - - cat $file_env - rm $file_env + echo "or other bash profile ( here : \"~/.bashrc\" for example), the same file you have set whith set_env.sh" fi