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
using sed to add letter after variable outthere_3 Shell Programming and Scripting 2 02-04-2008 08:17 PM
get only two letter from any string rinku Shell Programming and Scripting 2 01-18-2008 06:07 AM
what is dead.letter ?? jambesh Shell Programming and Scripting 2 08-30-2006 03:25 AM
SORT by letter murbina UNIX for Dummies Questions & Answers 1 05-12-2004 01:04 PM
dead.letter unisam UNIX for Dummies Questions & Answers 6 03-31-2004 02:33 AM

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 03-12-2009
glev2005 glev2005 is offline
Registered User
  
 

Join Date: Oct 2008
Posts: 74
If first letter of name is a-m do this if n-x do something else

so if I run echo $USER and the name is smithr i want to run command B to run because s is after m in the alphabet, but if the user is aldap I want command A to run because their first initial in the user name is in the first half of alphabet.

how please?
  #2 (permalink)  
Old 03-12-2009
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,860
Code:
case $USER in
  [a-m]* ) A ;;
  [n-z]* ) B ;;
esac
  #3 (permalink)  
Old 03-12-2009
sandholm sandholm is offline
Registered User
  
 

Join Date: Dec 2007
Location: New Hampshire
Posts: 20
Cool What about case?

Let me add to the previous example:

case $USER in
[a-mA-M]* ) A;;
[n-zN-Z]* ) B;;
esac

This way you'll match independent of case.
You know how "users" are!
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 09:11 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