* using brackets in scripts @ 2009-03-29 9:29 Pol 2009-03-29 10:43 ` Frank Terbeck 2009-03-29 10:45 ` Andrey Borzenkov 0 siblings, 2 replies; 7+ messages in thread From: Pol @ 2009-03-29 9:29 UTC (permalink / raw) To: zsh-users While the command ls -l save/*(.) returns a list of files, as expected, entering the same command in a shell script does not work, returning: Syntax error: "(" unexpected Any ideas? Thank you ----P ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: using brackets in scripts 2009-03-29 9:29 using brackets in scripts Pol @ 2009-03-29 10:43 ` Frank Terbeck 2009-03-29 10:45 ` Andrey Borzenkov 1 sibling, 0 replies; 7+ messages in thread From: Frank Terbeck @ 2009-03-29 10:43 UTC (permalink / raw) To: zsh-users Pol <xtekhne@gmail.com>: > While the command > ls -l save/*(.) > > returns a list of files, as expected, entering the same command in a shell > script does not work, returning: > > Syntax error: "(" unexpected > > Any ideas? You're using zsh's glob-qualifiers in a script interpreted by another shell. These qualifiers are zsh specific. Regards, Frank -- In protocol design, perfection has been reached not when there is nothing left to add, but when there is nothing left to take away. -- RFC 1925 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: using brackets in scripts 2009-03-29 9:29 using brackets in scripts Pol 2009-03-29 10:43 ` Frank Terbeck @ 2009-03-29 10:45 ` Andrey Borzenkov 2009-03-29 11:08 ` Pol 1 sibling, 1 reply; 7+ messages in thread From: Andrey Borzenkov @ 2009-03-29 10:45 UTC (permalink / raw) To: zsh-users, xtekhne [-- Attachment #1: Type: text/plain, Size: 407 bytes --] On 29 марта 2009 13:29:58 Pol wrote: > While the command > ls -l save/*(.) > > returns a list of files, as expected, entering the same command in a > shell script does not work, returning: > > Syntax error: "(" unexpected > > Any ideas? > Your script is likely being run by different shell (bash or whatever). I was not able to achieve this effect by (un-)setting zsh options. [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 197 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: using brackets in scripts 2009-03-29 10:45 ` Andrey Borzenkov @ 2009-03-29 11:08 ` Pol 2009-03-29 11:39 ` Atom Smasher 0 siblings, 1 reply; 7+ messages in thread From: Pol @ 2009-03-29 11:08 UTC (permalink / raw) To: zsh-users Andrey Borzenkov wrote: > Your script is likely being run by different shell (bash or whatever). I > was not able to achieve this effect by (un-)setting zsh options. My script starts with #!/bin/zsh but then commands are preceded by 'sudo' Same result if commands in script are not preceded by 'sudo', but the script itself is launched by 'sudo' . anyway, no errors when the command is entered through the interactive shell sudo ls -l save/*(.) Any ideas? ---P ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: using brackets in scripts 2009-03-29 11:08 ` Pol @ 2009-03-29 11:39 ` Atom Smasher 2009-03-29 15:12 ` Pol 0 siblings, 1 reply; 7+ messages in thread From: Atom Smasher @ 2009-03-29 11:39 UTC (permalink / raw) To: Pol; +Cc: zsh-users On Sun, 29 Mar 2009, Pol wrote: > My script starts with > #!/bin/zsh > > but then commands are preceded by 'sudo' > > Same result if commands in script are not preceded by 'sudo', but the > script itself is launched by 'sudo' . ================= within the script, run the commands "zmodload", "setopt" and "autoload -U zargs", and see if you get output that makes sense in a zsh environment. if not, the commands within your script are not being executed by zsh. also, on your command line, check the path to zsh: ls -lh =zsh it might be in /usr/local/bin/zsh, which might cause the script to default to a bourne shell, and the zsh glob tricks will fail. if the commands are preceded by sudo, try: sudo zsh -c ls -l save/*(.) or, try setting "SHELL=zsh" towards the top of the script, before invoking sudo. -- ...atom ________________________ http://atom.smasher.org/ 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808 ------------------------------------------------- "They tell us that we live in a great free republic; that our institutions are democratic; that we are a free and self-governing people. That is too much, even for a joke. Wars throughout history have been waged for conquest and plunder. And that is war in a nutshell. The master class has always declared the wars; the subject class has always fought the battles." -- Eugene V. Debs, 1918 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: using brackets in scripts 2009-03-29 11:39 ` Atom Smasher @ 2009-03-29 15:12 ` Pol 2009-03-30 10:42 ` zzapper 0 siblings, 1 reply; 7+ messages in thread From: Pol @ 2009-03-29 15:12 UTC (permalink / raw) To: zsh-users Atom Smasher wrote: sudo zsh -c ls -l save/*(.) > > or, try setting "SHELL=zsh" towards the top of the script, before invoking > sudo. > Problem solved: i have moved the line #!/bin/zsh to the top of the script (a few comment lines were on top, at my first attempt) Thank you, anyway ---P ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: using brackets in scripts 2009-03-29 15:12 ` Pol @ 2009-03-30 10:42 ` zzapper 0 siblings, 0 replies; 7+ messages in thread From: zzapper @ 2009-03-30 10:42 UTC (permalink / raw) To: zsh-users Pol wrote in news:gqo35b$dte$1@ger.gmane.org: > > Problem solved: i have moved the line > #!/bin/zsh > to the top of the script (a few comment lines were on top, at my first > attempt) > > Thank you, anyway > > ---P > Ah nostalgia that was one of first mistakes in scripting (not the last one of course!) -- zzapper http://www.successtheory.com/tips/vimtips.html http://www.successtheory.com/tips/cygwintips.php (in progress) ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-03-30 10:43 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-03-29 9:29 using brackets in scripts Pol 2009-03-29 10:43 ` Frank Terbeck 2009-03-29 10:45 ` Andrey Borzenkov 2009-03-29 11:08 ` Pol 2009-03-29 11:39 ` Atom Smasher 2009-03-29 15:12 ` Pol 2009-03-30 10:42 ` zzapper
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).