Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash exporting multiple functions

Tags:

bash

sh

Is there a cleaner/DRYer way to export multiple functions than how I am doing it here, just repeating the export -f command over and over?

foo() {
  echo "foo"
}

bar() {
  echo "bar"
}

baz() {
  echo "baz"
}

export -f foo
export -f bar
export -f baz
like image 581
Jadam Avatar asked Mar 11 '23 14:03

Jadam


1 Answers

export takes multiple arguments. You can do:

export -f foo bar baz
like image 97
heemayl Avatar answered Mar 21 '23 02:03

heemayl