'2021/11/23'에 해당되는 글 2건

  1. 2021.11.23 [cURL] cURL in Bash Script
  2. 2021.11.23 [Shell] Bash Random Number & Substring

[cURL] cURL in Bash Script

ITWeb/개발일반 2021. 11. 23. 15:35

Case 1)
response=`curl -s -X GET 'http://www.kakaopay.com' -H 'Content-Type: application/json' -d '{ "size": 100, "message": "test" }'`

Case 2)
curl -s -X GET 'http://www.kakaopay.com' -H 'Content-Type: application/json' -d '{ "size": 100, "message": "test" }'

Case 3)
size=100
message="test"

response=`curl -s -X GET 'http://www.kakaopay.com' -H 'Content-Type: application/json' -d '{ "size": '$size', "message": "'"$message"'" }'`

Case 4)
size=100
message="test"

curl -s -X GET 'http://www.kakaopay.com' -H 'Content-Type: application/json' -d '{ "size": '$size', "message": "'"$message"'" }'

proxy 를 지정 하고자 한다면 아래 내용 추가 합니다.
curl -x 'http://PROXY-IP:PROXY-PORT' -s -X GET 'http://www.kakaopay.com'

 

:

[Shell] Bash Random Number & Substring

ITWeb/개발일반 2021. 11. 23. 15:33

이런것도 기억력을 돕기 위해 기록해 봅니다.

 

- Bash Random Number
$ echo $(( $RANDOM % 4 ))

 

nodes=( '1' '2' '3' '4' )

i=$(( $RANDOM % 4 ))

node=${nodes[${i}]}

- Bash Substring
${String:Position:length} 문자:인덱스:길이

 

: