1

Do functions not exist in the sh shell? I am trying to convert a bash script to also run in sh and I'm having trouble dumbing down the code. Without functions and arrays, its become difficult to replicate the scripts functionality. Ideally I want to write one script that will run in either shell, not two slightly similar scripts.

Atomiklan
  • 5,164
  • 11
  • 40
  • 62

1 Answers1

3

There are functions in sh, but the function keyword is missing. Define your functions as

frobnicate () {
# ....
}

With arrays, you are out of luck.

choroba
  • 231,213
  • 25
  • 204
  • 289