I want to run the following commands from a bash script:
sudo cat << EOF>> /etc/profile
export LD_LIBRARY_PATH=/lib:/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
export JAVA_HOME=/opt/jdk1.6.0_22/
export PATH=${JAVA_HOME}/bin:/opt/tomcat/bin:${PATH}
EOF
sudo source /etc/profile
But a get a following errors:
/home/ak/init-script.sh: line 40: /etc/profile: Permission denied
sudo: source: command not found
Any help about how to achieve what i want?
Antonis