assigning value to shell variable using a function return value from Python

后端 未结 4 609
耶瑟儿~
耶瑟儿~ 2020-12-06 05:54

I have a Python function, fooPy() that returns some value. ( int / double or string)

I want to use this value and assign it in a shell script. For example following

4条回答
  •  无人及你
    2020-12-06 06:51

    You can print your value in Python, like this:

    print fooPy()
    

    and in your shell script:

    fooShell=$(python fooPy.py)
    

    Be sure not to leave spaces around the = in the shell script.

提交回复
热议问题