set_env_linux.sh 737 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

# Define the content to be added
content='export INFINI_ROOT="$HOME/.infini"
export LD_LIBRARY_PATH="$INFINI_ROOT/lib:$LD_LIBRARY_PATH"'

# Check if bashrc file exists
bashrc_file="$HOME/.bashrc"

if [ ! -f "$bashrc_file" ]; then
    echo "Creating $bashrc_file file"
    touch "$bashrc_file"
fi

# Check if the content already exists
if grep -q "export INFINI_ROOT=" "$bashrc_file"; then
    echo "INFINI_ROOT configuration already exists in $bashrc_file"
else
    echo "Adding configuration to $bashrc_file"
    echo "$content" >> "$bashrc_file"
    echo "Configuration added successfully"
fi

# Reload bashrc
echo "Reloading $bashrc_file"
source "$bashrc_file"

echo "Done! INFINI_ROOT and LD_LIBRARY_PATH have been set"