while writing the script getting an error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting while writing the script getting an error
# 1  
Old 07-09-2012
while writing the script getting an error

while writing a script m not able to convert string into a number therefore it is not picking the write if condition
pls help
Code:
#!/bin/sh
echo "this game is about selecting number and getting lucky"
echo " the number are 1 2 3 4 5 and 0 to exit"
read $a1
if [ "$a1" = 1 ]; then
                echo "NUMBER IS NOT CORRECT"
elif [ "$a1" = 2 ]; then
                 echo "NUMBER IS NOT CORRECT"
elif [ "$a1" = 3 ]; then
                 echo "NUMBER IS NOT CORRECT"
elif [ "$a1" = 4 ]; then
                echo "NUMBER IS NOT CORRECT"
elif [ "$a1" = 5 ]; then
                echo "NUMBER IS NOT CORRECT"
else
        echo "you win"
fi


Last edited by joeyg; 07-09-2012 at 11:20 AM.. Reason: Please wrap data and sripts with CodeTags
# 2  
Old 07-09-2012
change the below line
Code:
read $a1

to

read a1

# 3  
Old 07-09-2012
thanks a lot its done

---------- Post updated at 09:34 AM ---------- Previous update was at 09:31 AM ----------

one small help required we are looking ORACLE9i software and which is compatible with HP unix itanium.
can we get it from internet any where for free..... Smilie
# 4  
Old 07-09-2012
# 5  
Old 07-09-2012
thanks, but we want specifically oracle 9i bcz we are installing finacle
# 6  
Old 07-09-2012
i don't think, oracle is free for business. and i am not familiar with oracle.

Some one will reply for your answer.
# 7  
Old 07-09-2012
ohh thanks a lot
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Getting compilation error while writing standalone for ddi_get8

Hi All, I have already posted a thread regarding ddi_regs_map_setup solaris system call guidance. https://www.unix.com/programming/171907-need-guidance-using-ddi_regs_map_setup-solaris-system-call.html I am writing a standalone to use this system call. Below is my partial standalone... (6 Replies)
Discussion started by: vijayrajen
6 Replies

2. HP-UX

Please help me writing this script

I work on a production server. I have to check one folder named "spool" and delete files under it , which are more than 5 minutes old. I do it manually by writing two commands. touch -t YYMMDDHHMMSS /tmp/timeinfo find /spool ! -newer /tmp/timeinfo -exec rm -rf {} \; I want to... (4 Replies)
Discussion started by: manalisharmabe
4 Replies

3. Red Hat

writing a script

Dear Madam/Sir Who can help me with writing a script doing the following? 1- Read names of files (only files with special name format let say initially they have the same file name start like TT*) 2- Then create an empty files with the same names have been read in step one but with extension... (1 Reply)
Discussion started by: m.nageeb
1 Replies

4. HP-UX

DVD writing I/O Error on HP-UX

Hello, when I executed this command: root@server:/opt/ignite/lbinia> growisofs -Z /dev/rdsk/c1t2d0=/PA.iso I get the following output and error: Executing 'builtin_dd if=/PA.iso of=/dev/rscsi/c1t2l0 obs=32k seek=0' :-: I/O error Anyone have any idea what is happeneing? Here is... (1 Reply)
Discussion started by: LinuxRacr
1 Replies

5. Shell Programming and Scripting

Help in writing a script

Hey everyone Can anyone please write me a script to display numbers in descending order dynamically i.e if the user enter a number say 100 then the output should be like 100 99 ....so on till 0 I tried using the logic as for ((i =1; i<=100; i--) but the it goes into a infinite loop since even the... (7 Replies)
Discussion started by: icchi
7 Replies

6. Shell Programming and Scripting

error in file writing in crontab

Hi , I have a crontab job that is trying to write a file and the read it . But the crontab is not able to create any file . But when i run the script as shell then it runs fine . could you tell me what i am missing here . Here is the script cat Tablespace_Monitor_ATG #!/bin/ksh... (2 Replies)
Discussion started by: capri_drm
2 Replies

7. Shell Programming and Scripting

Writing to standard error

Hi, I want to redirect the standard output to standard error whenever an error occurs for ex if then echo right else echo wrong fi I want to redirect the wrong to stderror .Adding a line 1>&2 will do that or is additional code to be added.How can i verify whether the output... (2 Replies)
Discussion started by: padmisri
2 Replies

8. Shell Programming and Scripting

Writing the script

I whant write the script of monitoring my servers on night-active users. He must loging all user actions, when user login, when logout, when he do su etc. But i don't know with what to begin :( How command i can use? awk, sed, last And what logs i can use too? /var/log/messages, /var/log/secure... (1 Reply)
Discussion started by: jess_t03
1 Replies

9. UNIX for Dummies Questions & Answers

Writing to Standard Error

Hi. I'm working on a project for a class, and there's one part of the project that is confusing me. It's a compression and decompression project, and after we write our code for compression, we need to write to standard error. (1) Size of original file (number of characters read... (1 Reply)
Discussion started by: sjung10
1 Replies

10. UNIX for Dummies Questions & Answers

help for writing a script

Hi, I need help writing a unix script to change the time in the server automatically when it reaches a specified time. Only on the 14th of april, when the time becomes midnight (00:00:00), I need the server to change the time automatically to 23:30:00 and start working on as usual with a... (2 Replies)
Discussion started by: amodha
2 Replies
Login or Register to Ask a Question