Warning on a if

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Warning on a if
# 1  
Old 09-19-2011
Warning on a if

I'm having a difficult time finding this error. The script is pretty simple, you receive some information from the command line and the it ask you if you want to continue. The script continues, but it seems that miss the if.

PHP Code:
print "Press Y to continue"
read res

if [$res != "Y"];then
print "Exiting Script"
./change_version.sh 2.2.17 2.2.21 apache-2.2.17-testing-daniel apache-2.2.21-testing-daniel

You are about to copy the configurations and htdocs files from apache-2.2.17-testing-daniel to apache-2.2.21-testing-daniel
Press Y to continue
./change_version.sh[18]: [N: not found [No such file or directory]
Copying configuration files
Modifying files for the new version

# 2  
Old 09-19-2011
You need spaces around [ and ]

if [ $res != "Y" ];then

# 3  
Old 09-19-2011
Sir, thank you very much.
You show me how I can drown in a glass of water
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question