# Cygwin bash

**URL:** <https://boards.straightdope.com/t/cygwin-bash/157439>\
**Category:** Factual Questions\
**Created:** [February 25, 2003, 5:58pm UTC](https://boards.straightdope.com/t/cygwin-bash/157439 "2003-02-25T17:58:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Earthling](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@Earthling](https://boards.straightdope.com/u/Earthling)\
**Post date:** [February 25, 2003, 5:58pm UTC](https://boards.straightdope.com/t/cygwin-bash/157439/1 "2003-02-25T17:58:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChordedZither](https://avatars.discourse-cdn.com/v4/letter/c/e9c0ed/32.png) [@ChordedZither](https://boards.straightdope.com/u/ChordedZither)\
**Post date:** [February 25, 2003, 6:21pm UTC](https://boards.straightdope.com/t/cygwin-bash/157439/2 "2003-02-25T18:21:10Z")

</div>

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**

---

<div class="post-metadata">

**Author:** ![lothos2002](https://avatars.discourse-cdn.com/v4/letter/l/df788c/32.png) [@lothos2002](https://boards.straightdope.com/u/lothos2002)\
**Post date:** [February 25, 2003, 6:27pm UTC](https://boards.straightdope.com/t/cygwin-bash/157439/3 "2003-02-25T18:27:33Z")

</div>

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. 😃

---

<div class="post-metadata">

**Author:** ![Mr.Slant](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@Mr.Slant](https://boards.straightdope.com/u/Mr.Slant)\
**Post date:** [February 25, 2003, 6:31pm UTC](https://boards.straightdope.com/t/cygwin-bash/157439/4 "2003-02-25T18:31:31Z")

</div>

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.”

---

<div class="post-metadata">

**Author:** ![Mr.Slant](https://avatars.discourse-cdn.com/v4/letter/m/c57346/32.png) [@Mr.Slant](https://boards.straightdope.com/u/Mr.Slant)\
**Post date:** [February 25, 2003, 6:33pm UTC](https://boards.straightdope.com/t/cygwin-bash/157439/5 "2003-02-25T18:33:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![UnwrittenNocturne](https://avatars.discourse-cdn.com/v4/letter/u/6de8d8/32.png) [@UnwrittenNocturne](https://boards.straightdope.com/u/UnwrittenNocturne)\
**Post date:** [February 25, 2003, 6:37pm UTC](https://boards.straightdope.com/t/cygwin-bash/157439/6 "2003-02-25T18:37:54Z")

</div>

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**.

---

<div class="post-metadata">

**Author:** ![Earthling](https://avatars.discourse-cdn.com/v4/letter/e/90db22/32.png) [@Earthling](https://boards.straightdope.com/u/Earthling)\
**Post date:** [February 25, 2003, 6:40pm UTC](https://boards.straightdope.com/t/cygwin-bash/157439/7 "2003-02-25T18:40:02Z")

</div>

**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.
