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.
Asked
Active
Viewed 319 times
1 Answers
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
-
Ah sorry, I misunderstood. This solution does work in both bash and sh, thank you. – Atomiklan Jul 02 '14 at 15:28