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
  • 4,458
  • 10
  • 37
  • 56

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
  • 216,930
  • 22
  • 195
  • 267