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
get rid of special characters vakharia Mahesh UNIX and Linux Applications 4 07-29-2008 01:36 PM
Special Characters in directory name tez UNIX for Dummies Questions & Answers 6 08-14-2006 07:06 PM
how to see special characters in a file using vi jingi1234 UNIX for Dummies Questions & Answers 6 10-19-2005 11:57 AM
special characters nawnaw UNIX for Dummies Questions & Answers 2 05-18-2004 03:17 PM
awk/sed with special characters apalex Shell Programming and Scripting 5 05-06-2002 04:40 PM

 
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
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 11-20-2008
angelap angelap is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 2
Comparing Special characters (i.e. -,\,/) in an if statment

I need to validate the special characters of a date (the characters between the year and month & month and day). The data filed is being populated by users and read into the script vi an argument. I want to ensure that the date is a '-' (dash) and not a '/' or '\' (slash).

The every thing I have tried has failed and I have run out of ideas. I'm new to scripting and don't know where else to turn. Please help if you can. Thanks.

# ! /bin/ksh
set -x
V_DATE='2008-08-30'
echo $V_DATE
V_DATE_DASH1=`echo $V_DATE | cut -c 5`
echo 'INFO V_DATE_DASH1: ' $V_DATE_DASH1>>${LOGFILE}
V_DASH='-'
echo 'INFO V_DASH:'$V_DASH>>${LOGFILE}
echo $V_DATE_DASH1 = $V_DASH
if `${V_DATE_DASH1} = ${V_DASH}`
then echo 'INFO V_DATE_DASH1 is OK'>>${LOGFILE}
else echo 'ERROR V_DATE_DASH1 not a "-" '>>${LOGFILE}
usage
fi
 

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:21 PM.


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