Sponsored Content
Top Forums UNIX for Beginners Questions & Answers If condition is not working and getting error Post 302990169 by rbatte1 on Monday 23rd of January 2017 09:24:26 AM
Old 01-23-2017
The line if [ $SCORE -lt 0 -a $SCORE -gt 100 ]; then is looking to compare integers. You are giving it letter, which it cannot handle. You would be better to put the quit-test before it.

That said, you also don't check that someone enters the value b or Hello world! in there.

Is this a homework exercise?




Robin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

If condition not working

Hi Gurus, I have shell script in which i have to check if time is between to possible value or not. For that i am using following line of code if then echo 'Found In Between' echo $ftime ... (5 Replies)
Discussion started by: MANISH KU
5 Replies

2. Shell Programming and Scripting

error in if-else condition

Hi.. Im using the following script to find whether the present day is monday or not. If it is monday it has to do a specific set of things. #!/bin/sh Present_Date=`date` LOAD_DAY=`date -d "$Present_Date" | cut -d " " -f 1` echo $LOAD_DAY if ;then echo "Monday" #statements;... (6 Replies)
Discussion started by: abala
6 Replies

3. Shell Programming and Scripting

wild card in if condition not working

Hi, I am using RHEL5. I have following if condition. if In the above condition, if the value of a contains word WARNING, it should match. i.e., WARNING_MESSAGE, CRITICAL WARNING, WARNING ALERT etc. it should match. For b, alert error, ALERT ERROR, ERROR IMMEDIATE ACTION REQUIRED, etc... (2 Replies)
Discussion started by: user7509
2 Replies

4. UNIX for Advanced & Expert Users

If condition and htm not working

checkSync() { CONNECT_STRING=TLDB61/TLDB61@TL10G SQLPLUS_SETTINGS="SET PAGESIZE 0 LINESIZE 1500 ECHO OFF TRIMS ON TAB OFF FEEDBACK OFF HEADING OFF" SQL_RESULT_SYNC_PMCM=`sqlplus -s ${CONNECT_STRING} << EOF ${SQLPLUS_SETTINGS} (SELECT... (2 Replies)
Discussion started by: madfox
2 Replies

5. Shell Programming and Scripting

Using ssh to transfer file not working inside if-condition

Hi all, ssh uname@remote_server 'cat /tmp/remote_file_name > home_dir/a512386/new/local_file_name' The above given command is working fine. but if i try to move the file only if exists in the remote server i.e) giving the same within if condition it executes but the file is not stored in my... (1 Reply)
Discussion started by: Shri123
1 Replies

6. Shell Programming and Scripting

Condition error!

Hi Guys, Can you please help me to check if my condition is correct. if && then if ; then # active SE_USERID_LUZON_5="A" elif ; then # not active SE_USERID_LUZON_5="D" ${ECHO_CMD}... (3 Replies)
Discussion started by: nikki1200
3 Replies

7. Shell Programming and Scripting

while condition error:

I'm trying to run following code: while do echo "Hello World" done but I'm getting error on first line: ./test: line 1: syntax error near unexpected token `(' can anyone please tell me who can i run this loop. Also please tell me what will be syntax of do while loop in case i... (11 Replies)
Discussion started by: kashif.live
11 Replies

8. UNIX for Dummies Questions & Answers

error in if condition

Hi All, I need to compare the header of the input files which can be comma demilited, tild(~) or Pipr(|) seperated file. I am comparing the file header by taking 1st row and comparing it with input row: Below is the actual code:(ksh script) if then echo $dat >>... (4 Replies)
Discussion started by: abhi_123
4 Replies

9. Shell Programming and Scripting

Error: if condition

please follow below code if ; then its giving me an error as "test1.sh: line 3: r=$(eval echo '$lck_'$TABLE != "") if can anyone tell me how to do inside if condition...with out use any variable.. TIA (6 Replies)
Discussion started by: gnnsprapa
6 Replies

10. Shell Programming and Scripting

If condition on shell not working , not sure what is the mistake I am doing?

I have a requirement to perform specific set of tasks based on server , So I want to have the condition(s) defined based on server. Here is the script I came up with and I have read multiple blogs and couldn`t find any mistake from my script. Can you guide on what I am overlooking here ? ... (2 Replies)
Discussion started by: Varja
2 Replies
BATTLESTAR(6)							 BSD Games Manual						     BATTLESTAR(6)

NAME
battlestar -- a tropical adventure game SYNOPSIS
battlestar [-r] [saved-file] DESCRIPTION
battlestar is an adventure game in the classic style. However, it's slightly less of a puzzle and more a game of exploration. There are a few magical words in the game, but on the whole, simple English should suffice to make one's desires understandable to the parser. THE SETTING
In the days before the darkness came, when battlestars ruled the heavens... Three He made and gave them to His daughters, Beautiful nymphs, the goddesses of the waters. One to bring good luck and simple feats of wonder, Two to wash the lands and churn the waves asunder, Three to rule the world and purge the skies with thunder. In those times great wizards were known and their powers were beyond belief. They could take any object from thin air, and, uttering the word 'su' could disappear. In those times men were known for their lust for gold and desire to wear fine weapons. Swords and coats of mail were fashioned that could withstand a laser blast. But when the darkness fell, the rightful reigns were toppled. Swords and helms and heads of state went rolling across the grass. The entire fleet of battlestars was reduced to a single ship. SAMPLE COMMANDS
take --- take an object drop --- drop an object wear --- wear an object you are holding draw --- carry an object you are wearing put on --- take an object and wear it take off -- draw an object and drop it throw <object> <direction> ! <shell esc> IMPLIED OBJECTS
>-: take watermelon watermelon: Taken. >-: eat watermelon: Eaten. >-: take knife and sword and apple, drop all knife: Taken. broadsword: Taken. apple: Taken. knife: Dropped. broadsword: Dropped. apple: Dropped. >-: get knife: Taken. Notice that the "shadow" of the next word stays around if you want to take advantage of it. That is, saying "take knife" and then "drop" will drop the knife you just took. SCORE &; INVEN The two commands ``score'' and ``inven'' will print out your current status in the game. SAVING A GAME
The command ``save'' will save your game in a file called .Bstar in your home directory by default. You can recover a saved game by using the -r option when you start up the game, or by giving the name of the saved file as an argument. Save files will be saved to and restored from your home directory unless a path is specified - i.e., ``battlestar -r savedgame'' will look for savedgame in your home directory, but ``battlestar -r ./savedgame'' will look in the current directory. ``battlestar -r'' will look for the default file, .Bstar in your home directory. DIRECTIONS
The compass directions N, S, E, and W can be used if you have a compass. If you don't have a compass, you'll have to say R, L, A, or B, which stand for Right, Left, Ahead, and Back. Directions printed in room descriptions are always printed in R, L, A, and B relative direc- tions. HISTORY
I wrote Battlestar in 1979 in order to experiment with the niceties of the C Language. Most interesting things that happen in the game are hardwired into the code, so don't send me any hate mail about it! Instead, enjoy art for art's sake! AUTHOR
David Riggle INSPIRATION &; ASSISTANCE Chris Guthrie Peter Da Silva Kevin Brown Edward Wang Ken Arnold & Company BUGS
Countless. FAN MAIL
Send to edward%ucbarpa@berkeley.arpa, chris%ucbcory@berkeley.arpa, riggle.pa@xerox.arpa. BSD
September 7, 2000 BSD
All times are GMT -4. The time now is 07:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy