07-22-2009
Basic Unix bash script help
Hello there
Been using Unix bash scripting for two days now so am very new to this. I am currently doing a project now and i'm basically making a noughts and crosses game (or tic tac toe).
I have created the board using an array. When I try and check to see if the array is empty using an If function it says integer expression expected.
the code is as follows
if eval [ \$board$col1[$row1] - eq 1 ]
the 1 represents the empty space.
Cheers for any help
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Why do basic unix commands such as "ls" not work in "BASH" mode??
I am frustrated!! (10 Replies)
Discussion started by: PixelLover
10 Replies
2. UNIX for Dummies Questions & Answers
What I am supposed to do is creat a menu with the following
Find a song
Find a album
Sort by artist
Delete a song
Add a new song
Quit
Now the file with the song information is database
Here is what I have so far
#!/bin/bash
#=================================================
#Script Name:... (1 Reply)
Discussion started by: stp0052
1 Replies
3. Shell Programming and Scripting
Hi! I have a simple question about using a for loop.
I'm trying to open up all the zip files in the currect directory with ark, but I am getting the error "bash: syntax error near unexpected token `for $i ; do ark $i ; done ;
I looked in the info pages for bash, but I can't seem to figure... (2 Replies)
Discussion started by: Orange Stripes
2 Replies
4. Programming
Hey guys,
This is quite simply what I'm trying to make:
A program that runs in a UNIX terminal that you can output text messages to from another machine. These text messages would be prepended with a customized prompt. I'd also like to have the window spew out random dumps of flavor text not... (1 Reply)
Discussion started by: AcerAspirant
1 Replies
5. Shell Programming and Scripting
Howdy People :),
I'm a newbie & its my first question here. I've started learning Unix Bourne Shell scripting recently and struggling already :p Can someone PLEASE help me with the following problem. Somehow my script is not working.
Display an initial prompt of the form:
Welcome to... (1 Reply)
Discussion started by: methopoth
1 Replies
6. Shell Programming and Scripting
*This is not homework I am new to UNIX and want to try this Monitoring a file demo*
*If this is the wrong forum please move it - im new to the forums*
$1 = the file to be monitored
$2 = the time for the file to sleep
If the file gets changed (using -nt) it will send my username mail saying... (2 Replies)
Discussion started by: Nolan-
2 Replies
7. Shell Programming and Scripting
Hi, I am trying to make a script to manage log. I want to write the name of the .gz I moved and the date :
for i in `ls $replog/*.gz`
do
echo " $i "
`echo $i date +%d:%m:%Y`
`echo $datee `>> $replog/mrnet.log
mv $i /var/log/vieux-logs
done
I need to echo... (10 Replies)
Discussion started by: Dabless
10 Replies
8. Shell Programming and Scripting
Hi All,
I am trying to monitor CPU load of few processes, with the same name.
The output that I get from top is the following
28171 root 20 0 1089m 21m 3608 S 103 0.3 15:16.89 /opt/ppp//h264rtptranscoder.bin --videoPort=14504 --audioPort=14505
27589 root 20 0 1060m 23m... (3 Replies)
Discussion started by: liviusbr
3 Replies
9. UNIX for Beginners Questions & Answers
Hi everyone, first time visitor to these forums here.
Keeping a long story short I've been attempting to learn how to code in bash. I have VERY little previous experience with coding languages besides simply copying and pasting batch scripts for Windows. So, with that in mind I've followed a... (4 Replies)
Discussion started by: Meta
4 Replies
10. Shell Programming and Scripting
I am not able to execute bash script on Fedora. They were running on another environment. This is a sample script:
#!/usr/bin/bash
input="./data/heu/hout1"
i=1
j=0
while IFS= read -r file1
do
#Some code here
done < "$input"
#echo $j
I get an error:
bash: s.sh: command not... (3 Replies)
Discussion started by: ngabrani
3 Replies
LEARN ABOUT DEBIAN
make-aisleriot-freecell-board
HOOLA(6) board_gen HOOLA(6)
NAME
make-gnome-freecell-board, make-aisleriot-freecell-board, make-microsoft-freecell-board, make-pysol-freecell-board - Programs to generate
boards to be used as input to Freecell Solver.
SYNOPSIS
program [-t] board-number
or for make-pysol-freecell-board:
program [-t] [-F] board-number [game-string]
or for make-aisleriot-freecell-board:
program [-t] board-number [game-string]
DESCRIPTION
These programs are command-line programs that can generate the initial board of the Freecell games of several popular Solitaire
implementations. Those boards can be in turn be inputted to fc-solve by means of a pipeline, or placed inside a file for safe-keeping.
make-pysol-freecell-board and make-aisleriot-freecell-board also accept an optional third argument which indicates the game type. This type
defaults to Freecell, but is useful for generating the boards of other games. Note that using this flag does not preclude one from using
the "--game" flag of fc-solve.
make_pysol_freecell_board.py accepts another parameter called -F or --pysolfc that deals the PySolFC boards instead of the classic PySol
ones.
A common paradigm for using those programs is something like:
bash:~$ make-microsoft-freecell-board 11982 | fc-solve -l gi
If the "-t" option is specified, then the 10 cards are printed with "T"'s, instead of "10"'s. While this does not have any effect on fc-
solve it may prove useful for other solvers or solitaire implementations which do not accept "10"'s.
Here is a short description of each program:
make-gnome-freecell-board
Generate the boards of the standalone Freecell program that comes with the GNOME desktop.
make-aisleriot-freecell-board
Generate the Freecell boards of GNOME's AisleRiot.
make-pysol-freecell-board
A Python script that generates the boards of the various games of PySol.
make-microsoft-freecell-board
A program that generates the boards of Microsoft Freecell and of the Freecell Pro implementation of Freecell.
OPTIONS
board-number is the board number as a decimal number.
game-string is a string describing the game. Valid strings and their respective games are:
bakers_game - Baker's Game (*)
bakers_dozen - Baker's Dozen (Broken) (*)
beleaguered_castle - Beleaguered Castle (*)
citadel - Citadel
cruel - Cruel
der_katz - Der Katzenschwantz
die_schlange - Die Schlange
eight_off - Eight Off (*)
fan - Fan
forecell - Forecell
freecell - Freecell (the default)
good_measure - Good Measure
ko_bakers_game - Kings' Only Baker's Game
relaxed_freecell - Relaxed Freecell
relaxed_seahaven - Relaxed Seahaven Towers
seahaven - Seahaven Towers (*)
simple_simon - Simple Simon (*)
streets_and_alleys - Streets and Alleys
make-aisleriot-freecell-board supports only the games marked with an asterisk (*).
SEE ALSO
fc-solve (6)
/usr/share/doc/freecell-solver-bin/README.board_gen
AUTHOR
Shlomi Fish, <http://www.shlomifish.org/> .
board_gen 3.12.0 2012-06-22 HOOLA(6)