Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.
Florian Sellmayr edited this page Dec 18, 2015 · 3 revisions

Import: (:require [lambdacd.steps.shell :as shell]) Requires:

  • bash in $PATH

bash [ctx cwd & optional-env-and-commands]

Executes an arbitrary number of commands on the shell and starting in a particular working directory (cwd). Returns stdout and stderr as :out and the exit code as :exit

(shell/bash ctx "/some/directory" "pwd")
; => { :out "/some/directory" :exit 0 :status :success }

Steps are failing if the exit code is not 0:

(shell/bash ctx "/" "exit 1")
; => { :out "" :exit 1 :status :failure }

You can specify environment variables:

(shell/bash ctx "/" {"HELLO" "say hello world"} "echo $HELLO")
; => { :out "say hello world" :exit 0 :status :success }

You can specify more than one shell command and execution will stop after the first command fails (like set -e)

(bash ctx "/"
   "echo hello"
   "test 1 -eq 2"
   "echo this-shouldnt-be-reached")
; => { :out "hello" :exit 1 :status :failure }
Clone this wiki locally