pX0r
pX0r

Reputation: 1560

How to make Fabric use the bash shell insread of the default shell?

I am trying to use Fabric (Python3). My remove server uses "ksh" shell but I need to use "bash" shell. How do I achieve this using Fabric ?

Upvotes: 0

Views: 928

Answers (1)

Ben Sturmfels
Ben Sturmfels

Reputation: 1463

I do this with an environment variable called FABRIC_RUN_SHELL. For example:

export FABRIC_RUN_SHELL=/usr/bin/bash

You can also configure it directly in your fabfile.py:

@task
def my_task(c):
    pass

@task
def my_task2(c):
    pass

ns = Collection(my_task)
ns.configure({'run': {'shell': '/usr/bin/bash'}})

There are other options too, such as loading from a config file. Confusingly, all the details are in the Invoke configuration docs and not the Fabric docs. The fact that you use the FABRIC_ prefix instead of INVOKE_ is mentioned in the Fabric configuration docs.

Upvotes: 1

Related Questions