Jadam
Jadam

Reputation: 1765

Bash exporting multiple functions

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

Upvotes: 4

Views: 1551

Answers (1)

heemayl
heemayl

Reputation: 42017

export takes multiple arguments. You can do:

export -f foo bar baz

Upvotes: 8

Related Questions