Error Message


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Error Message
# 1  
Old 11-29-2006
Error Message

I keep getting an error message in a script im writing, this line is allways pointed out.

if [ $choice =1 ]

and this is the message i keep getting.

line 32: [: 8: unary operator expected

Whats wrong with it?

Please Help.
# 2  
Old 11-29-2006
try if [ $choice = "1" ]
______________^
_____________blank!
# 3  
Old 11-29-2006
If you surround $choice within double-quotes, then null values are retained.

You could do this.

Code:
if [ "$choice" = 1 ]

Or you could do

Code:
if [ x$choice = x1 ]

# 4  
Old 11-29-2006
Cheers

That worked but now im getting an error when an incorrect character is entered. Any ideas?
# 5  
Old 11-29-2006
Quote:
Originally Posted by chapmana
That worked but now im getting an error when an incorrect character is entered. Any ideas?
No ideas unless you show us what you tried. And what was the incorrect character ?

Looking at the variable name, I guess you are trying to read in user's choice from the command line. Show us the script.
# 6  
Old 11-29-2006
This is the code, but when i enter an if statement saying if greater that 12 the echo an error message but when im typing X in to exit its saying its an incorrect character entered but i thought that it wouldn't affect alpha characters?


Code:
clear
echo
echo
echo
echo
echo "***********************************Welcome to INET Diagnostics Utility ***********************************************"
echo "**********************************************************************************************************************"
echo
echo
echo
echo "                                          1) Ping Web Site"
echo "                                          2) Telnet"
echo "                                          3) Logit"
echo "                                          4) Pico"
echo "                                          5) Text Based Inetnet"
echo "                                          6) Files Counter"
echo "                                          7) File Lister"
echo "                                          8) Backup Directories"
echo "                                          9) Calculator"
echo "                                          10) Calender"
\echo "                                         11) FTP Client"
echo "                                          12) DNS Client"
echo "                                          X) Exit"
echo
echo
echo
echo
echo "                                          Choose your choice"
echo "**********************************************************************************************************************"
read choice

if [ "$choice" = "1" ]

    then

echo " To Escape A Ping Cycle Hold CTRL And Press C!"
echo
echo

sleep 4

echo "Which Site Do You Wish To Ping? (Include full extension without the www) "
read name
echo
echo
echo

ping -c 10 $name

echo "Hit Enter To Return To The Main Menu!"
echo "Paused............"
read
inet

   fi

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

What does this Error Message Mean

Hi I found the following error message in my logs: warning: /etc/hosts.deny, line 6: can't verify hostname: getaddrinfo(localhost) didn't return ::ffff:222.255.28.33 What is the error message trying to indicate? That there is a problem with line 6 (2 Replies)
Discussion started by: mojoman
2 Replies

2. UNIX for Dummies Questions & Answers

Error Message

What does this means? - ERROR OPENING FILE - KEY LENGHT MISMATCH (2 Replies)
Discussion started by: RDM00
2 Replies

3. Shell Programming and Scripting

Error message

I am new to scripting. I am using the following script . BART.dat contains the string 'Y' . #!/bin/ksh cd /work/TCI/data_out file=`cat BART.dat` echo "$file" if ; then echo "true" fi When i am executing the above script i am getting the following error ./s.ksh: : not found ... (2 Replies)
Discussion started by: ammu
2 Replies

4. UNIX for Dummies Questions & Answers

getting last error message

Question for unix programmers - what function I need to used to get the exact error message when the library failed to load? Thanks (1 Reply)
Discussion started by: tttttt
1 Replies

5. UNIX for Advanced & Expert Users

Error message

Hi, My Solaris 5.8 system keeps getting this error at boot - "Can't set vol root to /vol" then /usr/sbin/vold: can't set vol root to /vol: Resource temporarily unavailiable Any idea what is wrong, and how do I fix it? (1 Reply)
Discussion started by: ghuber
1 Replies

6. Solaris

Error message

Hi, My Solaris 5.8 system keeps getting this error at boot - "Can't set vol root to /vol" then /usr/sbin/vold: can't set vol root to /vol: Resource temporarily unavailiable Any idea what is wrong, and how do I fix it? (0 Replies)
Discussion started by: ghuber
0 Replies

7. UNIX for Advanced & Expert Users

Error message

I'm getting an error - symbol referencing errors. No output written to, etc Can anybody tell me why this is? (2 Replies)
Discussion started by: Dan Rooney
2 Replies

8. UNIX for Dummies Questions & Answers

Error Message

Hi everyone, Can anyone explain what the following error refers to...and perhaps a solution? vxfs: vx_nospace -/tmp file system full (8 block extent) Thanks, Uni (2 Replies)
Discussion started by: Uni
2 Replies

9. UNIX for Dummies Questions & Answers

error message

Hi All, occasionally my server gives this error messages "NOTICE:HTFS Out of inodes on HTFS dev hd (1/42)" why ?? Alice. (3 Replies)
Discussion started by: alisev
3 Replies
Login or Register to Ask a Question