The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
plz clear my doubts soumya_v7 UNIX for Dummies Questions & Answers 3 03-13-2008 01:06 PM
What command do you use to clear the print que? nov_user UNIX for Dummies Questions & Answers 1 10-01-2007 10:09 AM
Clear confusion vibhor_agarwali UNIX for Dummies Questions & Answers 4 07-14-2005 05:21 AM
clear memory fenomen UNIX for Dummies Questions & Answers 2 06-24-2003 06:33 AM
How to clear screen giannicello High Level Programming 2 05-14-2002 01:32 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 04-03-2006
Registered User
 

Join Date: Feb 2006
Posts: 27
Problem with clear command

Hi All

I'm currently writing a very simple UNIX script to process some work. The very first thing I do on my script is use the "clear" command.

how my file looks...

clear
echo "Return status: $?"

For some strange reason, the return status being returned is 1, not 0 as i expected.

Has anyone ever encountered an anomaly like this before, or could there be some account permissions problem? It's very simple code, so basic that it's got me completely stumped!

Any help would be much appreciated.
Reply With Quote
Forum Sponsor
  #2  
Old 04-03-2006
pressy's Avatar
solaris cultist
 

Join Date: Aug 2003
Location: Vienna / Austria (Europe) [EARTH]
Posts: 718
hmmm, perhabs the clear command doesn't know your terminal type:

root@jumpy # TERM=asdf
root@jumpy # export TERM
root@jumpy # clear
root@jumpy # echo $?
3
root@jumpy #
root@jumpy # tput clear
tput: unknown terminal "asdf"
root@jumpy #


gP
Reply With Quote
  #3  
Old 04-03-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,614
To get a 1 as the return code, TERM has to a known terminal, but one without a "clear" capability. Try:
export TERM=dumb
tput clear # Or just "clear"...there is a shell wrapper for clear
echo $?
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:09 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0