![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| regular expressions | melanie_pfefer | UNIX for Dummies Questions & Answers | 8 | 04-10-2008 04:24 AM |
| regular expressions | whatever | Shell Programming and Scripting | 4 | 05-20-2007 04:30 PM |
| regular expressions | ragha81 | UNIX for Dummies Questions & Answers | 2 | 03-05-2007 07:24 PM |
| Regular Expressions | AresMedia | Shell Programming and Scripting | 1 | 08-22-2002 03:55 PM |
| Regular expressions in sed | mfreemantle | Shell Programming and Scripting | 2 | 02-12-2002 04:43 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
passing regular expressions to mysql via $1
hi, unix and mysql gurus.
i'm trying to create a simple ksh script that accesses the mysql system database table, user. the idea is that the user can call the script with a regular expression to see some users, or call it without any options to see all users. this is what i have so far: ***************************************************** mysql -BCNnqs --disable-pager -u system -pmanager << EOJ use mysql; set @regex = '$1'; select user from user where user REGEXP @regex; quit EOJ ***************************************************** the problem, of course, is that if $1 is null, i get this error: ==> ERROR 1139 (42000) at line 8: Got error 'empty (sub)expression' from regexp i changed my set statement to this, but it didn't work: ***************************************************** set @regex = if(@regex is null, '^[a-z]','$1'); ***************************************************** does anyone know what i'm doing wrong? i'd appreciate your input. thanks. |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|