I use the following script to do the following actions in my environment:   Creating an Nginx site conf. Creating a corresponding Let'sEncrypt SSL certificate. Creating a symlink between my sites-default dir to my site conf. Restarting the server.   My code:  #!/bin/sh for domain; do     &gt; "/etc/nginx/sites-available/${domain}.conf" cat &lt;&lt;EOF         server {             root /var/www/html/${DOMAIN};             server_name ${DOMAIN} www.${DOMAIN};              location ~ /\.ht {                 deny all;             }              location / {                 index index.php index.html index.htm fastcgi_index;                 try_files $uri $uri =404 $uri/ /index.php?$args;             }              location ~*  \.(jpg|jpeg|png|gif|ico|css|js|ttf|woff|pdf)$ {                 expires 365d;             }              location ~ \.php$ {                 fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;                 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;                 include fastcgi_params;             }         }     EOF     sudo ln -s /etc/nginx/sites-available/${domain} /etc/nginx/sites-enabled/     #########################################################################     certbot --nginx -d ${DOMAIN} -d www.${DOMAIN} done systemctl restart nginx.service # Create Webapp Substrate.   How and why I want to improve this code:  Where the long row of hashmarks, I want to insert the following command:  echo 'create database ${DOMAIN}; create user "${DOMAIN}"@"localhost" identified by "mypassword"; grant all privileges on ${DOMAIN}.* to ${DOMAIN};' | mysql -u root -p   Adding this command will change the script to do 5 steps instead 4:   Creates an Nginx site conf. Creates a corresponding Let'sEncrypt SSL certificate. Creating a symlink between my sites-default dir to my site conf. Adding an all privileged, and authenticated DB user suitable only for localhost, with a DB with the same name. Restarting the server.     My question:  As you can see, I used my parameter ${DOMAIN} inside the echo. I did that because I must pass the same argument there as well, otherwise, the DB username and it's associated DB both won't fit my site conf and my Wordpress based site won't boot.  Is this operation logical in Bash or you would take another approach?  To clarify, I ask this to understand if passing arguments based on parameters is valid when the parameter is inside an echo.
I frequently need to do the following things in MySQL:   Create a non-root user Set that user's password Grant that user all privileges Make a database with the same name as the new user Allow usage only for users from the localhost.   Previously I did this using PHPmyadmin, but I would prefer doing it directly from BASH. Is there a CLI way to execute these steps?
Does option "-h" for "ls" display size in MB or MiB and is it consistent over Unix-based systems? Prove that the product of a non-zero rational and irrational number is irrational. Why does DNS work the way it does? This is a  about DNS (Domain Name Service).   If my understanding of the DNS system is correct, the .com registry holds a table that maps domains (www.example.com) to DNS servers.   What is the advantage? Why not map directly to an IP address? If the only record that needs to change when I am configuring a DNS server to point to a different IP address, is located at the DNS server, why isn't the process instant? If the only reason for the delay are DNS caches, is it possible to bypass them, so I can see what is happening in real time? Get Emacs to ignore contents of \Sexpr{} command in Sweave document to prevent incorrect $-based syntax highlighting How does Ethernet know how long a frame is? I'm currently working on the following problem for my computer theory class. It goes as follows:     Let $A$ and $B$ be regular expressions. Show then that $A^*B$ is the solution   of $X = AX + B$   Am I supposed to let $X = A^*B$? If so then   $A^*B = A(A^*B) + B$  I can understand that  $A(A^*B)$ could be reduced to $A^*B$ but what happens with the "${}+ B$" part of the expression? I've read up on Kleene algebra and found an axiom that seems relevant in which      $b + ax ≤ x → a^∗b ≤ x$   but I'm not actually sure if it applies. Cycles Normal Bake does'nt bake indents that are not tapered A  is river or stream that flows into a larger river.  A  a stream branching off a river.    Is there a word that combines both structures, the idea of a river that splits in two and later rejoins to become one river again?           /---------------\ ---------                 --------------------          \---------------/   My focus here is on the waterway, not the land. I’m looking for a word describing the behavior of the river splitting and later rejoining, without regard for the geography, and without regard for the cause or effect between land and water. I'm trying to compute the shadow of 3D objects on the ground. To do this I'm assuming parallel rays from Sun origin.   Let's assume the Sun direction is given by azimuth $\varphi$ and elevation $\theta$ angles. So the direction unit vector is retrieved as:  $$ \hat{\mathbf{s}} = \mathbf{R}_y\left(\theta\right)\mathbf{R}_z\left(\varphi\right)\hat{\boldsymbol{\imath}}$$  where $\mathbf{R}_{x/y/z}$ are the rotation matrices along the $x, y, z$ axes given by, for example, Euler-Rodrigues equation, and $\hat{\boldsymbol{\imath}}$ is the unit vector along $x$-axis.  A point on a ray-line has the equation:  \begin{equation} \mathbf{r} = \mathbf{r}_p + \lambda\hat{\mathbf{s}}  \tag{1} \end{equation}  being $\mathbf{r}_p$ a point on that line.  A point on a general plane is given by the equation:  \begin{equation} \left(\mathbf{r} - \mathbf{r_0}\right)\cdot \hat{\mathbf{n}} = 0 \tag{2} \end{equation}  being $\mathbf{r}_0$ a point on the plane and $\hat{\mathbf{n}}$ the unit vector normal to that plane.   Ensuring the validity of both equations (1) and (2) allows to compute the $\lambda$ multiplier and retrieve the position vector of the projected point (writing $\tilde{\mathbf{r}} = \mathbf{r_p} - \mathbf{r_o}$)  \begin{gather} \lambda = - \left(\frac{\tilde{\mathbf{r}}\cdot \hat{\mathbf{n}}} {\hat{\mathbf{s}}\cdot\hat{\mathbf{n}}}\right) \\ \mathbf{r}_\text{proj} = \mathbf{r}_p - \left(\frac{\tilde{\mathbf{r}}\cdot \hat{\mathbf{n}}} {\hat{\mathbf{s}}\cdot\hat{\mathbf{n}}}\right)\hat{\mathbf{s}} \tag{3} \end{gather}  Applying eq. (3) to all the vertices of a mesh $\left\{\mathbf{r}_{p_i}\right\}$ .   A problem can be noted: $\hat{\mathbf{s}}\cdot \hat{\mathbf{n}}$ can be zero (e.g. Sun is horizontal, i.e. the ray is ortogonal to the normal of plane).   Are there some conceptual mistakes in my reasoning? Is there a way to rewrite the operation as a linear operator applied to the set of vertices position vectors?   $$ \left[\mathbf{A}\right]\left\{\mathbf{r}_{p_i}\right\} = \mathbf{r}_\text{proj}$$ How do I remove extra Skype icon or ghost icons for removed apps from GNOME shell? How does Intel Turbo Boost work? Let $(X,d)$ be a metric space and let $S$ be the set of Cauchy sequences in $S$. Define "~" in $S$ by "$\{s_k\}$ ~ $\{t_k\}$" to mean that $d(s_k,t_k) \to 0$ as $k \to \infty$. Let $X'$ denote the set of equivalence classes of $S$ and let $s'$ denote the equivalence class of $s = \{s_k\}$.   I know $\phi(s',t') = \lim\limits_{k \to \infty} d(s_k,t_k)$ is a metric on $X'$.   Show $(X',\phi)$ is complete.  For $x \in X$, define $x'$ to be the equivalence class of the constant sequence ${x,x,...}$. Show that the function $x \to x'$ is an isometry of $X$ onto a dense subset of $X$.   If anyone can share a proof, or steer me in the right direction, maybe tell me what it is that I need to prove specifically, that would be great. I am an Indian passport holder travelling from China to India via Kuala Lumpur, on Air Asia tickets bought separately. The layover is 4 hours and 30 minutes.  Do I need a transit visa? How do you compute the earth's radius at a given geodetic latitude? Seven-sided dice from five-sided dice with finite rolls I have a 5-sided dice, and I want to use it to simulate a 7-sided dice. Is there a way to do this with a finite number of rolls? As I am seeing this,  the man and boat will have different displacement from ground frame,  so there should be a net work done by friction .  The books says,  total work done by friction is zero when friction is static and internal to system. Please explain.. Sum of $\frac{1}{(2n)(2n+1)}$ from $1$ to infinity build argument lists containing whitespace I'm going to guess that the answer is "no" based on the below error message (and ), but is there anyway to perform a cross-database query using PostgreSQL?  databaseA=# select * from databaseB.public.someTableName; ERROR:  cross-database references are not implemented:  "databaseB.public.someTableName"   I'm working with some data that is partitioned across two databases although data is really shared between the two (userid columns in one database come from the users table in the other database). I have no idea why these are two separate databases instead of schema, but c'est la vie... Why does the reputation need to be publicly displayed?