# SSH runner shell expansion?

**URL:** <https://drone.discourse.group/t/ssh-runner-shell-expansion/3538>\
**Category:** Drone Support\
**Created:** [June 5, 2020, 12:01pm UTC](https://drone.discourse.group/t/ssh-runner-shell-expansion/3538 "2020-06-05T12:01:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mayzie](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@Mayzie](https://drone.discourse.group/u/Mayzie)\
**Post date:** [June 5, 2020, 12:01pm UTC](https://drone.discourse.group/t/ssh-runner-shell-expansion/3538/1 "2020-06-05T12:01:17Z")

</div>

Hi everybody! 🙂 :

I’m using Drone’s new SSH runner (it’s really good!), but I’m having some trouble where a command involves some bash shell expansion. In particular, trying to restart a bunch of services like `systemctl --user restart server@{1..8}.service` does not seem to work? Must I escape it, or is there another way to do what I want? How would I go about doing that?

Thank you all so much in advance! 🙂

---

<div class="post-metadata">

**Author:** ![ashwilliams1](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/ashwilliams1/32/5549_2.png) [@ashwilliams1](https://drone.discourse.group/u/ashwilliams1)\
**Post date:** [June 5, 2020, 3:38pm UTC](https://drone.discourse.group/t/ssh-runner-shell-expansion/3538/2 "2020-06-05T15:38:50Z")

</div>

> systemctl --user restart server@{1…8}.service

Drone would not make any changes to this command since it is not a bash variable (does not match `${variable}` syntax), so there is no need to escape anything. Drone takes the above command and generates a shell script, uploads that shell script to your server (using sftp) and then executes it. The generated shell script looks something like this:

```auto
#!/bin/sh

systemctl --user restart server@{1..8}.service

```

Unfortunately we do not really have the full details details (error message, steps to reproduce, etc) so it is difficult for me to advise on possible root causes without speculating. However, one common root cause we see is that sometimes people use `bash` syntax which may not be compatible with `sh`, or may not be compatible with the version of `sh` installed on the target machine.

---

<div class="post-metadata">

**Author:** ![Mayzie](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@Mayzie](https://drone.discourse.group/u/Mayzie)\
**Post date:** [June 5, 2020, 4:59pm UTC](https://drone.discourse.group/t/ssh-runner-shell-expansion/3538/3 "2020-06-05T16:59:33Z")

</div>

Oh, I did not know that. Thank you! 🙂

And I was talking about shell expansion, so things like `{1..3}` would convert to `1 2 3`, etc. It seems the bare bones shell does not support it, which is a shame 😕 Is it possible to change the default shell back to bash?

---

<div class="post-metadata">

**Author:** ![ashwilliams1](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/ashwilliams1/32/5549_2.png) [@ashwilliams1](https://drone.discourse.group/u/ashwilliams1)\
**Post date:** [June 6, 2020, 3:43pm UTC](https://drone.discourse.group/t/ssh-runner-shell-expansion/3538/4 "2020-06-06T15:43:58Z")

</div>

> Is it possible to change the default shell back to bash?

to ensure posix compliance Drone will always use `sh` but you can always execute bash commands or even invoke a bash script from your pipeline.

For example like this:

```auto
kind: pipeline
type: ssh
name: default

steps:
- name: restart
  commands:
  - bash -c "systemctl --user restart server@{1..8}.service"

```

Or like this:

```auto
kind: pipeline
type: ssh
name: default

steps:
- name: restart
  commands:
  - bash restart.sh

```

Or even this may work:

```auto
kind: pipeline
type: ssh
name: default

steps:
- name: restart
  commands:
  - echo "systemctl --user restart server@{1..8}.service" > restart.sh
  - bash restart.sh

```
