re my bash script problems
First, let me thank all of you for your input and interest in my problem. I will look into our implementation of Apache and where it is expecting cgi. I haven't even begun to troubleshoot the web interface issue yet as my script fails outright when it is called as a script from the command line. The more baffling question is why my script does not execute as a script from the command line in a shell session when it will execute if I do a copy and paste of each line of code. Regardeing permissions, the results do not change even when I give global permissions for everything (I know, unwise, but just did it to test) Here is my code: #!/bin/bash counter=1 outfile=/usr/local/httpd/htdocs/veronica/test if [ -s $outfile ] ; then read counter < $outfile counter=$counter+1 fi echo $counter >/usr/local/httpd/htdocs/veronica/test echo done It is embarrassingly simple, I admit, but could it be the code itself? I don't get any syntax errors when I run it line by line, but it sure does not work when I call it from the command line. Thanks again.
Veronica Hernandez writes:
First, let me thank all of you for your input and interest in my problem.
I will look into our implementation of Apache and where it is expecting cgi. I haven't even begun to troubleshoot the web interface issue yet as my script fails outright when it is called as a script from the command line. The more baffling question is why my script does not execute as a script from the command line in a shell session when it will execute if I do a copy and paste of each line of code.
Regardeing permissions, the results do not change even when I give global permissions for everything (I know, unwise, but just did it to test)
Here is my code:
#!/bin/bash counter=1 outfile=/usr/local/httpd/htdocs/veronica/test if [ -s $outfile ] ; then read counter < $outfile counter=$counter+1 fi echo $counter >/usr/local/httpd/htdocs/veronica/test echo done
Yep it works. Is there any space before the #!/bin/bash line? Or any whitespace on the line at all. Does /etc/shells have an entry for /bin/bash?
It is embarrassingly simple, I admit, but could it be the code itself? I don't get any syntax errors when I run it line by line, but it sure does not work when I call it from the command line.
Thanks again.
participants (2)
-
Jesse Marlin
-
Veronica Hernandez