Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 4th, 2005, 5:49 PM   #1
troubleshooter
Newbie
 
Join Date: Apr 2005
Posts: 4
Rep Power: 0 troubleshooter is on a distinguished road
syntax problems.

hi, i need some help trouble shoting some syntax problems,

in a normal terminal when i type
ls !(*.zip)
it all works fine.
but when i try a simple script such as

#!/bin/bash

ls !(*.zip)
i get

Quote:
~/src/scripts$ ./test.sh
./test.sh: line 3: syntax error near unexpected token `('
./test.sh: line 3: `ls !(*.zip)'
and the only way i can get it to work is by chaning it to
#!/bin/bash
ls !(`*.zip`)
but it doesnt work how i want it

so could anyone show me why its working differntly in the terminal and script and show me what would be the correct syntax?

thanks
troubleshooter is offline   Reply With Quote
Old Apr 4th, 2005, 6:54 PM   #2
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
I only got this far before giving up...

This shows all the *.zip files (not all but *.zip)...

#!/bin/bash
CMD="*.zip"
echo $CMD
tempest is offline   Reply With Quote
Old Apr 5th, 2005, 9:34 PM   #3
troubleshooter
Newbie
 
Join Date: Apr 2005
Posts: 4
Rep Power: 0 troubleshooter is on a distinguished road
i figured it out.
shopt extglob was set to off when running a script but was turned on when using the teriminal.
troubleshooter is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:11 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC