Nov 112019
 

Add to .bashrc:

export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} ip=\$( echo \$PWD | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' ) "

Now if you browse to/in a directory which has an ipv4 ip, the IP will be stored in the $ip variable.

 Posted by at 21:09

Sorry, the comment form is closed at this time.