modify set and unset env
This commit is contained in:
BIN
Binary file not shown.
+8
-13
@@ -1,20 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
file_env=tempFILE
|
|
||||||
if [ -e "$file_env" ] ; then
|
|
||||||
rm "$file_env"
|
|
||||||
fi
|
|
||||||
if [ "$#" -le 0 ] ; then
|
if [ "$#" -le 0 ] ; then
|
||||||
|
echo "if need permanent config"
|
||||||
echo "Usage: $0 file_name" >&2
|
echo "Usage: $0 file_name" >&2
|
||||||
echo "for example: $0 ~/.bashrc" >&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
|
else
|
||||||
file_env=$1
|
echo "export CPATH=$PWD/include_ytest/include:\$CPATH" >> $1
|
||||||
fi
|
echo "export LD_LIBRARY_PATH=$PWD:\$LD_LIBRARY_PATH" >> $1
|
||||||
echo "export CPATH=$PWD/include_ytest/include:\$CPATH" >> $file_env
|
source $1
|
||||||
echo "export LD_LIBRARY_PATH=$PWD:\$LD_LIBRARY_PATH" >> $file_env
|
|
||||||
|
|
||||||
if [ "$#" -le 0 ] ; then
|
|
||||||
cat $file_env
|
|
||||||
rm $file_env
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+5
-11
@@ -1,17 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
file_env=tempFILE
|
|
||||||
if [ -e "$file_env" ] ; then
|
|
||||||
rm "$file_env"
|
|
||||||
fi
|
|
||||||
if [ "$#" -le 0 ] ; then
|
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 "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 "or other bash profile ( here : \"~/.bashrc\" for example), the same 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
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user