![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| bash preferred or ksh with bash features | mrwatkin | UNIX for Dummies Questions & Answers | 2 | 06-17-2009 02:19 PM |
| how to make your bash script run on a machine with csh and bash | npatwardhan | Shell Programming and Scripting | 3 | 11-19-2008 04:17 AM |
| bash and ksh: variable lost in loop in bash? | estienne | Shell Programming and Scripting | 2 | 08-25-2008 03:09 PM |
| passing variable from bash to perl from bash script | arsidh | Shell Programming and Scripting | 10 | 06-04-2008 01:25 PM |
| Why generate "ash and bash" different output for same bash script? | s. murat | Shell Programming and Scripting | 0 | 05-26-2008 08:19 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Bash Help
I have ksh script and converting to bash . This portion is failing .
code in ksh: Code:
read choice
until [[ $tries -gt 2 || $choice = +([0-9]) && $choice -gt 0 \
&& choice -le "${#rdbms[*]}" ]]; do
print -n "Invalid choice - must enter number between 1"
print -n " and ${#rdbms[*]}: "
read choice
let tries=tries+1
done
Code:
line 235: syntax error in conditional expression: unexpected token `('
line 235: syntax error near `+(['
line 235: ` until [[ $tries -gt 2 || $choice = +([0-9]) && $choice -gt 0 \'
Thanks Last edited by vgersh99; 08-25-2009 at 02:06 PM.. Reason: code tags, PLEASE! |
| Bits Awarded / Charged to talashil for this Post | |||
| Date | User | Comment | Amount |
| 08-25-2009 | vgersh99 | added code tags - charged 3K bits | -3,000 |
|
|||||
|
Hi.
I suggest experimenting with bash builtin shopt: Code:
If the extglob shell option is enabled using the shopt builtin, several
extended pattern matching operators are recognized. In the following
description, a pattern-list is a list of one or more patterns separated
by a |. Composite patterns may be formed using one or more of the fol-
lowing sub-patterns:
?(pattern-list)
Matches zero or one occurrence of the given patterns
*(pattern-list)
Matches zero or more occurrences of the given patterns
+(pattern-list)
Matches one or more occurrences of the given patterns
-- excerpt from man bash
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|