简体   繁体   中英

linux shell `sed` result to variable,`line 51: 422: command not found`

HTTP_CODE= `echo "[{"key":"usernameError","message":"用户名错误"}] 422" | sed -En 's/^.* ([0-9]+)$/\1/p'`
echo "${HTTP_CODE}"

echo "[{"key":"usernameError","message":"用户名错误"}] 422" | sed -En 's/^.* ([0-9]+)$/\\1/p' return 422

but `to var` command not found

Remove the space after the =. I made a mistake

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM