B! 19 0 0 0 シェルスクリプトで関数を定義する時、functionと付けても付けなくても 定義出来たりしますが、 その辺のしっかりとした定義について。 function foo or foo () foo () any-command foo () any-compound-command function foo { …; } function foo () { …; } function foo () other-compound-command まとめ function foo or foo () Bashなどのシェルスクリプトで関数を定義するには function foo { ... } の様にfunctionを前に付けて定義するか foo () { ... } の様にfunctionを使わずに後ろに()を付けて定義するのが通常です。 今まで作ってるスクリプト(Bash)
![シェルスクリプトでの関数の書き方について](https://cdn-ak-scissors.b.st-hatena.com/image/square/e2fe72c9f18aaae8d8df76c013a56f8d12bff7c3/height=288;version=1;width=512/https%3A%2F%2Frcmdnk.com%2Fimages%2Fpost%2F20180129_shellscript.jpg)