How to pass command line parameters with quotes stored in single variable?

前端 未结 5 1126
闹比i
闹比i 2021-01-07 03:58

I want to call external application from shell script, but this shell script gets parameters (from other script) in a single variable. All was OK until I did not have to use

5条回答
  •  醉酒成梦
    2021-01-07 04:15

    This might work, although it's hard to tell without knowing how sh_param handles its arguments.

    #!/bin/sh
    
    pass() {
        echo "Result with \"\$@\""
        ./sh_param "$@"
    }
    
    pass "single param" separate params
    

提交回复
热议问题