bash profile setting
hi,
i tried to set the apache home in red hat.we have two apache home one is default and another one is istalled newly. we create the user apache. bash_profile echo please type the apache home read c a=new if $c=$a then export APACHE_HOME=/usr/local/apache2 PATH=$PATH:$APACHE_HOME/bin else export APACHE_HOME1=/etc/httpd fi we got the following errors please type the apache home new -bash: new=new: command not found is it possible to set the two apache homes in same bash profile. |
This should solve your problem -- change the line
Code:
if $a=$c Code:
if [ "$a" = "$c" ] |
Tests need to be in square brackets '[]'
eg. if [ $c = $a ] then # do something fi I usually put strings in double quotes and leave numbers bare eg STRING1="some garbage" if [ "$STRING1" = "hello" ] .... COUNT=5 if [ $COUNT -eq 7 ] ... Please note there are different types of tests depending on the data types, here's a reference: http://www.oreillynet.com/linux/cmd/cmd.csp?path=t/test cheers |
Double brackets [[ ]] is more robust http://tldp.org/LDP/abs/html/testcon...ml#DBLBRACKETS
|
What kpb wrote except [[ ]] is preferred for testing over [ ].
|
All times are GMT -5. The time now is 12:04 AM. |