# ElasticSearch shell script fails due to unsupported syntax on non-Bash shells

**URL:** <https://discuss.elastic.co/t/elasticsearch-shell-script-fails-due-to-unsupported-syntax-on-non-bash-shells/13603>\
**Category:** Elasticsearch\
**Created:** [September 14, 2013, 3:04am UTC](https://discuss.elastic.co/t/elasticsearch-shell-script-fails-due-to-unsupported-syntax-on-non-bash-shells/13603 "2013-09-14T03:04:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian\_yoder](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@brian\_yoder](https://discuss.elastic.co/u/brian_yoder)\
**Post date:** [September 14, 2013, 3:04am UTC](https://discuss.elastic.co/t/elasticsearch-shell-script-fails-due-to-unsupported-syntax-on-non-bash-shells/13603/1 "2013-09-14T03:04:27Z")

</div>

In version 0.90.3 (at least), the first line of the elasticsearch start-up  
script is:

#!/bin/sh

And on line 92 the line is:

JAVA=$(which java)

But, not all Unix-based systems point _/bin/sh_ to /bin/bash or /bin/ksh.  
And the $(command) syntax is not supported by the Bourne shell or by dash  
(Ubuntu) to which /bin/sh is sometimes linked by default.

The correct fix would probably be to change line 92 to use the backtics  
that all of the shells support:

JAVA=`which java`

I've opened the following bug to report this:

> <https://github.com/elastic/elasticsearch/issues/3691>

Brian

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 2:16am UTC](https://discuss.elastic.co/t/elasticsearch-shell-script-fails-due-to-unsupported-syntax-on-non-bash-shells/13603/2 "2017-07-06T02:16:33Z")

</div>


