I have a bash runmydocker.sh
script whose purpose is to retrieve the string sent by the user when he is calling that script and create a DNS in etc/hosts
.
Example:
The user (developer) will call runmydocker.sh mysitephp7.com
. This script will retrieve the string mysitephp7.com
and insert it into /etc/hosts
as 127.0.0.1 mysitephp7.com
and then initialize docker.
Then when the developer writes in the browser url mysitephp7.com
the system would be loaded using the docker server. Note that this DNS did not exist on the hosts before the script.
All steps are ready except for inserting this string mysitephp7.com
.com into / etc / hosts.
What would be the proper way to do this?