Calling bash function from a bash function which takes arguments like any other language? -


this question has answer here:

i new bash scripting , trying find way call bash function bash function takes 1 or many arguments passed have in other languages ?

for example.

function b() {     echo "$1 world!" }  function a() {     b("hello!") } 

with call function "a" give output of hello world! (i not sure if work). appreciated.

thank you

just add parameters after function call, separated white space (just parameters of main function in c or java binary).

the following script:

#!/bin/bash  function b() {     echo "$1 world!" }  function a() {     b "hello!" }  

will output hello! world!.

surround parameter double-quotes if needed.

example:

$ b x y x world! $ b "x y" x y world! 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -