Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-13-2008, 04:35 AM   #1
LQ Newbie
Registered: Jul 2008
Posts: 8

Rep: Reputation: 0
unary operator expected


I was running a smarttest on a drive and got this error.

smarttest: line 120: [: -ge: unary operator expected

Any Ideas what this means. Never seen this before. And google was no help on this one...

Old 07-13-2008, 07:05 AM   #2
Registered: Aug 2005
Location: Ukraine
Distribution: Ubuntu 9.04
Posts: 99
Blog Entries: 3

Rep: Reputation: 19
Try running
smartctl -a $drive
where $drive is your hard drive, /dev/sda, /dev/hda or so. Then look for the bottom of the output:

SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Short offline Completed without error 00% 136 -

If you have such line, then there is problem with this script not interpreting this correctly. If you don't, chances are that you haven't run SMART test on this hard drive previously. If this is the case, run

smartctl --test short $drive

And wait for about 3 minutes. You can see the progress of this test by running smartctl -a $drive, along the lines of

Self-test execution status: ( 241) Self-test routine in progress...
10% of test remaining.

After that, smarttest should be able to fill "$HOURS" variable inside the script.

Some bits of details:
The line looks like

if [ $HOURS -ge 26280 ]; then

With HOURS value missing it transforms into "if [ -ge 26280 ]; then ..." while -ge is not an unary operator, i.e. it accepts 2 arguments, while it is supplied only one.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unary operator error hinetvenkat Programming 7 10-26-2008 12:22 PM
Binary operator expected - error mike9287 Linux - Newbie 9 07-17-2006 09:27 AM
Unary Operator expected. Bash script Blackout_08 Programming 2 06-22-2006 03:21 PM
wait_event_interruptible - invalid lvalue in unary `&' 7.e.Q Programming 4 11-08-2004 03:00 AM
Unary expressions loke137 Programming 1 08-17-2003 03:12 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:20 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration