bash scipting
hey am trying to write a basc script for tick tack toe... i have done most of it ...but it does break when it needs and also i can seem to figure how to do the winner bit... so if anyone can help it would be great
|
The first problem I found is that it does not do something rational if you enter something besides a number. In some cases, it shows error messages, and then repeats the prompt. But it then does not correctly handle a correct entry. My approach would be to fix this first before proceeding.
|
so how would i do that
|
Quote:
|
I improved your game but spoiled your play. A lot of debugging but it was funny. Thank you and my apologies.
Code:
#!/bin/bash |
Quote:
|
Quote:
I found a clever way: use this in an "if" construct: [ $var -eq $var 2>/dev/null ] if $var is a number then the exit value is 0 (true), otherwise it is 2 |
All times are GMT -5. The time now is 09:24 PM. |