Sponsored Content
Top Forums Shell Programming and Scripting Shell Text Based Game, This Error Makes NO sense. Please help Post 302732241 by lemonoid on Saturday 17th of November 2012 02:06:39 AM
Old 11-17-2012
SOLVED

Quote:
Originally Posted by elixir_sinari
That should not be a problem at all. The last ;; in the case construct is optional.

@OP: To which if does the fi on line 62 correspond?
yeah its not the ;; in the case, it's not required at the end of the case statement (although it isn't a bad habit). it IS required for multiple case statements. And as far as the fi on line 62, I was just reviewing my code, and it was one of those things that I just kept looking over and I noticed. I got on here to post this as resolved. The fi was a mistake due to the copy and pasting from the other scenario of the game. I know copy/paste causes a lot of errors and I browsed it for misplaced quotation marks and various other errors, but I forgot that the whole statement that I copied was part of an if statement from the other scenario. That fi on line 62 should not have been there, there only should have been the one on line 60 but thank you so much for your prompt response to this. I've just began learning scripting and bash as a whole about 4 days ago, so I'm sure this is going to be a go-to source for help in this text based game. I'm just trying to find a way to spice it up and once I do I'm sure I'll have way more complicate code than [ICODE]case[/ICODE[, while/do and nested if statements!!
 

9 More Discussions You Might Find Interesting

1. Linux Benchmarks

Linux Benchmarks Makes No Sense

I created two computers with identical hardware, and run the benchmark programs in both starting at the same exact time. What makes no sense is that the computer that has the lower average index (121) finished the race a good 30 minutes ahead of the computer wich showed the higher avg index... (0 Replies)
Discussion started by: philip_38
0 Replies

2. UNIX for Dummies Questions & Answers

Simple grep - Not sure it makes sense!

I have 3 files in directory mydir named as follows, I run the sequence of commands shown below and I have questions at the result. File names are: ABC_GP0 ABC_GP0.ctl ABC_GPX Commands and results: $ ls /mydir/ | grep * <-- (q1) I get nothing - OK $ ls /mydir/ | grep... (5 Replies)
Discussion started by: GNMIKE
5 Replies

3. Shell Programming and Scripting

BASH: How do I grep on a variable? (or simmilar question that makes sense)

Hi, I've been running code which very frequently calls books.csv. e.g: grep -i horror books.csv > tempExcept, I'm trying to move away from using temporary files or frequently calling books.csv to improve efficiency. So I tried something like bookfile=$(cat books.csv) grep -i horror... (4 Replies)
Discussion started by: Quan
4 Replies

4. Shell Programming and Scripting

diff result makes no sense

Hi, I have written a small shellscript Imagine dbalt.txt already existed... " .... touch report.txt lynx -dump "http://site.com/index.htm" > site1.txt lynx -dump "http://site.com/index2.htm" > site2.txt grep -E 'Nummer: |EUR' site1.txt > preis1.txt grep -E 'Nummer: |EUR' site2.txt >... (2 Replies)
Discussion started by: Blackbox
2 Replies

5. UNIX for Dummies Questions & Answers

text based football game?

Is there a textbased football game (American) that I can download through ubuntu server edition? (1 Reply)
Discussion started by: dadoprso
1 Replies

6. Shell Programming and Scripting

Making a Text based game. Need help.

Okay so Zork sparked my interest in this. I have been learning to program for the last year and a half. I've dabbled in everything from Java to Ruby to PHP & XHTML & SQL, and now I'm on bash. I really like bash scripting. Its easy and fun. I just started two days ago. Pretty much I've been writing... (1 Reply)
Discussion started by: lemonoid
1 Replies

7. Programming

This Makes NO sense. I'm making a game and getting an error, need help.

Okay so I'm making a simple text based game that branches into different scenarios. By branching I mean branching off into whole different files with that part of the game in it. I got tired of working on scenario 1 so I'm working on scenario 2. As I get started and try to test it, I get an error... (1 Reply)
Discussion started by: lemonoid
1 Replies

8. UNIX for Dummies Questions & Answers

[Solved] Making a text based game

Hello, I am looking to make a text based game, that runs in the command window, or a window similar. I will only need to use 1 window. I read somewhere that there is libraries for this kind of thing? But I can't remember the name of them.. Can anyone point me in a direction? I will be... (2 Replies)
Discussion started by: murphy
2 Replies

9. Shell Programming and Scripting

Creating a text based game using shell script.

Hello guys I'm new to shell scripting and I need to make a game using shell script. I want to know if it is possible for me a total noob to shell scripting to make this game. The game concept is simple: First thing when you launch the script you get a menu in which you select if you want to... (3 Replies)
Discussion started by: Othmane
3 Replies
Devel::Cover::Tutorial(3pm)				User Contributed Perl Documentation			       Devel::Cover::Tutorial(3pm)

NAME
Devel::Cover::Tutorial - An introduction to code coverage VERSION
version 0.89 TUTORIAL
Here's part of a message I sent to perl-qa about code coverage metrics. 1.0 Introduction It is wise to remember the following quote from Dijkstra, who said: Testing never proves the absence of faults, it only shows their presence. In particular, code coverage is just one weapon in the software engineer's testing arsenal. Any discussion of code coverage metrics is hampered by the fact that many authors use different terms to describe the same kind of coverage. Here, I shall provide only a brief introduction to some of the most common metrics. 2.0 Metrics 2.1 Statement coverage This is the most basic form of code coverage. A statement is covered if it is executed. Note that statement != line of code. Multiple statements on a single line can confuse issues - the reporting if nothing else. Where there are sequences of statements without branches it is not necessary to count the execution of every statement, just one will suffice, but people often like the count of every line to be reported, especially in summary statistics. However it is not clear to me that this is actually useful. This type of coverage is fairly weak in that even with 100% statement coverage there may still be serious problems in a program which could be discovered through other types of metric. It can be quite difficult to achieve 100% statement coverage. There may be sections of code designed to deal with error conditions, or rarely occurring events such as a signal received during a certain section of code. There may also be code that should never be executed: if ($param > 20) { die "This should never happen!"; } It can be useful to mark such code in some way and flag an error if it is executed. Statement coverage, or something very similar, can be called statement execution, line, block, basic block or segment coverage. I tend to favour block coverage which does not attempt to extend its results to each statement. 2.2 Branch coverage The goal of branch coverage is to ensure that whenever a program can jump, it jumps to all possible destinations. The most simple example is a complete if statement: if ($x) { print "a"; } else { print "b"; } In such a simple example statement coverage is as powerful, but branch coverage should also allow for the case where the else part is missing: if ($x) { print "a"; } Full coverage is only achieved here if $x is true on one occasion and false on another. 100% branch coverage implies 100% statement coverage. Branch coverage is also called decision or all edges coverage. 2.3 Path coverage There are classes of errors that branch coverage cannot detect, such as: $h = undef; if ($x) { $h = { a => 1 }; } if ($y) { print $h->{a}; } 100% branch coverage can be achieved by setting ($x, $y) to (1, 1) and then to (0, 0). But if we have (0, 1) then things go bang. The purpose of path coverage is to ensure that all paths through the program are taken. In any reasonably sized program there will be an enormous number of paths through the program and so in practice the paths can be limited to a single subroutine, if the subroutine is not too big, or simply to two consecutive branches. In the above example there are four paths which correspond to the truth table for $x and $y. To achieve 100% path coverage they must all be taken. Note that missing elses count as paths. In some cases it may be impossible to achieve 100% path coverage: a if $x; b; c if $x; 50% path coverage is the best you can get here. Loops also contribute to paths, and pose their own problems which I'll ignore for now. 100% path coverage implies 100% branch coverage. Path coverage and some of its close cousins, are also known as predicate, basis path and LCSAJ (Linear Code Sequence and Jump) coverage. 2.4 Expression coverage When a boolean expression is evaluated it can be useful to ensure that all the terms in the expression are exercised. For example: a if $x || $y The expression should be exercised with ($x, $y) set to (0, 0) (required for branch coverage), (0, 1) and (1, 0) (to ensure that $x and $y are independent) and possibly with (1, 1). Expression coverage gets complicated, and difficult to achieve, as the expression gets complicated. Expressions which are not directly a part of a branching construct should also be covered: $z = $x || $y; a if $z; Expression coverage is also known as condition, condition-decision and multiple decision coverage. 3.0 Other considerations In order to get people to actually use code coverage it needs to be simple to use. It should also be simple to understand the results and to rectify any problems thrown up. Finally, if the overhead is too great it won't get used either. So there's a basic tutorial on code coverage, or at least my version of it. Typing a few of these terms into google will probably provide a basis for future research. LICENCE
Copyright 2001-2012, Paul Johnson (paul@pjcj.net) This software is free. It is licensed under the same terms as Perl itself. The latest version of this software should be available from my homepage: http://www.pjcj.net perl v5.14.2 2012-06-15 Devel::Cover::Tutorial(3pm)
All times are GMT -4. The time now is 03:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy