rush icon indicating copy to clipboard operation
rush copied to clipboard

User defined shell functions

Open osheari1 opened this issue 2 years ago • 2 comments

Prerequisites

  • [x] make sure you're are using the latest version by rush -V
rush v0.5.0

Checking new version...
You are using the latest version of rush
  • [x] read the usage (rush -h) and examples

Describe your issue

I'm trying to use rush from within a shell script with a user defined bash function, but am getting the command not found: XYZ error.

test.sh

#!/bin/bash

run() {
    echo $1
}

seq 5 | rush run {}

>>> ./test.sh
zsh:1: command not found: run
zsh:1: command not found: run
18:01:27.372 [ERRO] wait cmd #3: run 3: exit status 127
zsh:1: command not found: run
18:01:27.372 [ERRO] wait cmd #4: run 4: exit status 127
18:01:27.373 [ERRO] wait cmd #2: run 2: exit status 127
zsh:1: command not found: run
zsh:1: command not found: run
18:01:27.373 [ERRO] wait cmd #1: run 1: exit status 127
18:01:27.374 [ERRO] wait cmd #5: run 5: exit status 127
  • [x] describe the problem
  • [x] provide a reproducible example

osheari1 avatar Nov 15 '22 18:11 osheari1

Export the function or use ‘set -a’ command at the beginning of the code

sakyb7 avatar Apr 01 '23 23:04 sakyb7

Thanks @sakyb7. I also had to set SHELL=/bin/bash because my default shell was fish

mizzunet avatar Apr 02 '23 06:04 mizzunet