0
#!/bin/sh

get_json_response(){
  status=$1
  mode=$2
  errorcode=$3
  json_response=`python getJsonResponse.py $status $mode $errorcode`
  return json_response
}

get_json_response 0 0 0 

I get the following error when I try to run the above code -

./tryfunction.sh

./tryfunction.sh: line 8: return: json_response: numeric argument required

How should I rectify this error?

  • 1
    AFAIK shell functions may only return integer values - if your getJsonResponse.py code returns something other than an integer value (a string for example) then you will need to re-think your approach – steeldriver Apr 10 at 1:28
  • Thank you for the response. – user4002112 Apr 10 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.