modify set and unset env

This commit is contained in:
2023-10-23 20:32:27 +02:00
parent ba1d058742
commit 0b134bb20b
3 changed files with 13 additions and 24 deletions
+8 -13
View File
@@ -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