The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
is there any way to check if some ip is taken ? umen UNIX for Dummies Questions & Answers 4 02-08-2006 11:42 AM
Script to check for a file, check for 2hrs. then quit mmarsh UNIX for Dummies Questions & Answers 2 09-16-2005 03:46 PM
Can you check this alias? guelpth UNIX for Dummies Questions & Answers 0 02-18-2005 08:38 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-24-2005
gopskrish gopskrish is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 26
How can i check for a day

Hi,

When i tried this I am getting bad number
if [[ $(date '+%a') -eq Sat ]]; then now=saturday echo $now; else now=notsaturday echo $now; fi

How can i check for the same.

Thanks in advance
(I am new to Unix and so i raise some silly questions, please dont mistake me)
cheers,
gops
  #2 (permalink)  
Old 06-24-2005
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,122
$(date '+%a') = Sat
  #3 (permalink)  
Old 06-24-2005
RishiPahuja's Avatar
RishiPahuja RishiPahuja is offline
Registered User
  
 

Join Date: Apr 2005
Location: Bangalore, India
Posts: 203
Thumbs up

Use

if [[ $(date '+%a') = Sat ]]; then
now=saturday
echo $now
else
now=notsaturday
echo $now
fi

Note: -eq is meant for numeric comaprisions.
  #4 (permalink)  
Old 06-24-2005
gopskrish gopskrish is offline
Registered User
  
 

Join Date: Jun 2005
Posts: 26
Hi ,

With you people around , I think i can go for some complicated scripts.
I am really happy with the way I am getting the replies.

Thanks vgersh99 & Rishi (for correcting me about eq sign and for providing the solution).

cheers,
gops
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:45 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0