brackets in bash shell
Plz check the code...
Code:
#!/bin/sh Quote:
|
|
Maybe because you're running the code with /bin/sh and in compatibility mode with the old Bourne Shell the syntax is not correct. Anyway, the $[...] construct for integer expansion is deprecated and it should be avoided in favor of the arithmetic operator ((...)).
On the other hand, if you're really writing a script for the Bourne shell, better to use expr. |
after changing to /bin/bash, everything ran correctly...
|
All times are GMT -5. The time now is 02:05 AM. |