python脚本内容示例
#!/bin/env python
# -*- coding: utf-8 -*-
import datetime
import os
URL = "sfas.gre.g"
PORT = 3408
方法一:利用正则表达式匹配(已验证成功)
shell脚本代码
#!/bin/bash
export PYTHON_HOME=/home/cbd/etl/python
port=`cat ${PYTHON_HOME}/etl_config.py | grep -o -E "port(\s*)=.*" | cut -d '=' -f 2 | grep -o -E "[^\"\s]*"`
url=port=`cat ${PYTHON_HOME}/etl_config.py | grep -o -E "url(\s*)=.*" | cut -d '=' -f 2 | grep -o -E "[^\"\s]*"`