#!/bin/sh
result=$(curl -s -H application/x-www-form-urlencoded -X POST https://aux.xxx.cn/connect/token -d 'client_id=10017' -d 'client_secret=KGhAXePnxjHQVsnwgoPEU7xzwH3yEJKkEwqjBVOH1Cork1G7i5lafTOD0I5fchIO' -d 'grant_type=client_credentials')
echo $result
len=$(expr length $result)
pos=$(expr index $result '"access_token":"')
pos_len=$(expr $len - $pos - 16)
pos=$(expr $pos + 16)
echo $pos_len,$pos
new_result=$(expr substr $result $pos $pos_len)
echo $new_result
pos=$(expr index $new_result '","')
pos_len=$(expr $pos - 1)
pos=1
token=$(expr substr $new_result $pos $pos_len)
echo $token