79156188

Date: 2024-11-04 16:09:48
Score: 1
Natty:
Report link

You can lookup here how to manipulate strings in bash: https://tldp.org/LDP/abs/html/string-manipulation.html

And by utilizing expr you can do regular expressions:

#!/bin/bash

# Various irrelevant stuff
https_proxy="http://username:password@proxy-host:port"
proxy_user=`expr $https_proxy : '.*\/\([^:]*\)'`
proxy_pw=`expr $https_proxy : '.*\:\(.*\)@'`

echo $proxy_user
echo $proxy_pw
Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: White Owl