Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User defined shell functions #44

Open
4 tasks done
osheari1 opened this issue Nov 15, 2022 · 2 comments
Open
4 tasks done

User defined shell functions #44

osheari1 opened this issue Nov 15, 2022 · 2 comments

Comments

@osheari1
Copy link

Prerequisites

  • 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

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
  • describe the problem
  • provide a reproducible example
@osheari1 osheari1 changed the title User defined functions User defined shell functions Nov 15, 2022
@sakyb7
Copy link

sakyb7 commented Apr 1, 2023

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

@mizzunet
Copy link

mizzunet commented Apr 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants