Cygwin bash

Is there any reason (other than I’m an idiot) that I can’t invoke built-in commands (e.g., typeset) from within a shell script? It’s a problem that I’ve never encountered before, running the same scripts under UWIN’s ksh, or, before that, on a real-deal Unix account (also ksh). I suspect it has something to do with my profile (which is whatever Cygwin’s default is – I just installed it), but can’t tell.

Also, for arithmetic operations, the syntax shown in the O’Reilly book, Learning the bash Shell, doesn’t seem to work (e.g., let x=1+3 or $((1+3)), and I have to go back to the old expr construct. Any ideas?

Cygwin tells me it’s bash 2.05b, and it’s running on top of Windows 2000, even though I don’t think that matters.

Thanks much.

Shell scripts under Cygwin are usually running under sh (which is actually a renamed ash in CygWin) rather than under bash.

The built-in commands for the two are quite different. If you really need your script to run with bash features, start your script with the line

#!/bin/bash

Is this that leetspeek the youngens talk about?:dubious:
Speak English, man!

Sorry, but it just looks weird when you have no clue what it is about. :smiley:

No. Leetspeek is more like:
“j00 h4v3 b33n j4cI<3d bY Gr4nD m4st3r 0r4ng3 j00ce!”
“You have been hacked by Grand Master Orange Juice. Fnord.”

Amend “j4cI<3d” to h4cI<3d for the english word hacked.

If cygwin is running sh then I cannot help, but what O’reilly says (given your example) about bash is right, leading me to agree with Chorded Zither (love that name) about you not being under bash.

ChordedZither: Just tried #!/bin/bash, and it seems to work. Thanks!

It’s been a loooooong time since I’ve used the Bourne shell, and actually I’d really like to stick with ksh, but UWIN was serious misbehaving, so I’m giving Cygwin a try (rather than spending big bucks on MKS Toolkit). As it is, I’m finding out there are lots of differences between ksh and bash, too, but oh well.