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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 10-08-2008
ankimo ankimo is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 23
sorry about that and thanks for your response Franklin52.

i have a script that has this syntax: script <group_id> <user_name> <regex>

rules:
* the user can enter single or multiple group_ids and/or user_names
* the regex is optional
* group_ids are 5-digit integers
* user_names are can be a combo of chars and integers


because the regex parameter is optional, i want to check if it was added at the command line. further, if the regex was actually added, then i want to use that regex value against a different script that i created:


Code:
if any parameter begins with a special character; then
  run a different script with the regex parameter
else
  do something else
fi
here's as far as i got.. and i admit, it's not far....


Code:
if [ "$*" begins with any of these '[][\\.*$^]/\\&' ]
  ./script2 regex
else
  do something else
fi
thanks