1

I want to modify a variable (preferably in a Bash Script format) because my PHP environment requires a port number.

To show a URL in Drush containing a token that logs you in as user 1 (without a password), you need to execute drush uli

$ drush uli

In a script:

bash-3.2$ VAR='drush uli'; echo ${VAR}; ${VAR}

outputs:

drush uli
http://website-7-26-2-17-res124725.local/user/reset/1/1393147909/zMiquSr_ikA7xdp7kA3g4CvTGd82mWsVdqEiMCs/login

I need to manipulate the variable VAR to add port 8088

http://website-7-26-2-17-res124725.local:8088/user/reset/1/1393147909/zMiquSr_ikA7xdp7kA3g4CvTGd82mWsVdqEiMCs/login

..and then avoid Drush to open the URL but open the new URL with a browser instead:

VAR='drush uli';
read ${VAR}
# replace ".local" with ".local:8088"
ObjURL=${VAR//.local/.local:8088}
# open URL in browser 
open ${ObjURL}

with the proper escaping.

Can I modify that URL before Drush opens the browser and manipulate the URL when invoked from a Bash script?

Mau
  • 181
  • 1
  • 6

0 Answers0