I'm trying to execute a script from a different server using ssh   Here's the command I'm using from server 1 to launch a query on server 2:  ssh -t user@xxx.xxx.xxx.xx "cd /var/www/vhosts/xxxxx/subdomains/preprod/; sudo ./replace.sh";   but the problem is that when I do sudo the $home = /root while the script is under: /var/www/vhosts/xxxxx/subdomains/preprod/  How can i tell sudo to preserve the environment?  I tried sudo -P - , sudo -H, without any luck.
This is the PATH variable without sudo:  $ echo 'echo $PATH' | sh  /opt/local/ruby/bin:/usr/bin:/bin   This is the PATH variable with sudo:  $ echo 'echo $PATH' | sudo sh /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin   As far as I can tell, sudo is supposed to leave PATH untouched. What's going on? How do I change this? (This is on Ubuntu 8.04).  UPDATE: as far as I can see, none of the scripts started as root change PATH in any way.  From man sudo:      To prevent command spoofing, sudo   checks ``.'' and ``'' (both denoting   current directory) last when searching   for a command in the user's PATH (if   one or both are in the PATH). Note,   however, that the actual PATH   environment variable is not modified   and is passed unchanged to the program   that sudo executes.
When the phrase is used as an object, why so many native speakers are saying "you and I" instead of "you and me"? I'm not a native speaker but I thought "you and me" is correct. Not sure if this falls into the same category, but "Just between you and me" sounds more natural than "Just between you and I". I've just bought a new Toshiba laptop, on which Windows 8 is preinstalled. I've installed Ubuntu Gnome 13.10 and GRUB2 correctly detects Ubuntu and Windows. But the strange problem is that when I try to boot Windows 8, it appears the following error:  /EndEntire file path:/ACPI(a0341d0,0)/PCI(2,1f)/UnknwnMessaging(12)/HD(2,200800,82000,a8d996409dcfe211,a8,59)/File(\EFI|Microsoft\Boot)/File(bootmgfw.efi)/EndEntire error: cannot load image.   I've tried to solve using boot-repair, using the auto-correction. But never has changed. Here is the log generated by boot-repair:   How can I fix this? What are the transactional costs when buying and selling a house? Photoshop using Marque Tool > Path > Circular But Not a perfect shape? Please consider this image below :   This is happened when I have a circular shape (marquee tool selection). THen after that I converted to Work Path (by right click of that selection). And I add 2.0 as its Tolerance Pixel.   After applying it. The shape become not perfect, could you see the difference? I make it with a black background so everyone could see it from the image no.2.  I realized this is a problem, because If i use that path for placing a text. the text wont follow the correct path as circular (selection), instead ... the shape a bit changed (i think it's ugly shape :: see the detail of the arrow).  How to solve this case ? I'm using Photoshop CS3. Distributing distinct apples and pears to three people so that each person receives at least one pear How many ways are there to distribute seven distinct apples and six distinct pears to three distinct people such that each person has at least one pear.   Note: The first part of the problem was the same but the word distinct was replaced with identical apples and pears. That answer is $360$ ways.   What has to be done differently when the word identical is replaced with distinct? How does LIGO remove the effects of environmental noise? Since LIGO is dealing with readings at nanometers, events such as vehicles driving nearby, and constant (but extremely minor) tremors of the earth can cause movement with the mirrors at nanometers.  Such tiny movements are extremely difficult to measure, but can easily cause errors when using such a small scale.  How does LIGO remove these factors, and take precautions to prevent false readings due to noise? "Not being good at swimming, he didn't like it." Could we omit the word "being" here? Not being good at swimming, he didn't like it.   Could we omit the word "being" here?     Not good at swimming, he didn't like it.   Which one is grammatically correct? I need help to find the Galois Group of $x^5 +1$. I know that it has a 5-cycle and a 4 cycle and is not a subgroup of $A_5$. Thanks! Introductory Calculus textbook for physics? Combining values in one column (or part) when values in another column (or part) match Why is $\mathbb{C}[x,y]/(y^2 - x^3 + 1)$ normal? One of the topics that seems to come up regularly on mailing lists and online discussions is the merits (or lack thereof) of doing a Computer Science Degree. An argument that seems to come up time and again for the negative party is that they have been coding for some number of years and they have never used recursion.  So the question is:   What is recursion? When would I use recursion? Why don't people use recursion? Is it possible that $a_n>0$ and $\sum a_n$ converges then $na_n \to 0$? (without assuming $a_n$ is decreasing) Why do we use Hermitian operators in QM? Position, momentum, energy and other observables yield real-valued measurements. The Hilbert-space formalism accounts for this physical fact by associating observables with Hermitian ('self-adjoint') operators. The eigenvalues of the operator are the allowed values of the observable. Since Hermitian operators have a real spectrum, all is well.  However, there are non-Hermitian operators with real eigenvalues, too. Consider the real triangular matrix:  $$ \left( \begin{array}{ccc} 1 &amp; 0 &amp; 0 \\ 8 &amp; 4 &amp; 0 \\ 5 &amp; 9 &amp; 3 \end{array} \right)  $$  Obviously this matrix isn't Hermitian, but it does have real eigenvalues, as can be easily verified.  Why can't this matrix represent an observable in QM? What other properties do Hermitian matrices have, which (for example) triangular matrices lack, that makes them desirable for this purpose? How typeset a numeric table from a CSV file I have a CSV file (db.txt)like this:  30.0,   0.0,    0.0 60.0,   1.9098, 5.8779 90.0,   6.9098, 9.5106 120.0,  13.09,  9.5106 150.0,  18.09,  5.8779 180.0,  20.0,   0.0   I need to typeset it. My problem is related with the wrong alignment of decimal point and the number of decimals (must be a constant for each column):  \renewcommand*{\dtlrealalign}{r}  \DTLloaddb[     noheader,     keys={x,y,theta},     headers={         \shortstack{$\boldsymbol{\theta_{2,i}}$},         \shortstack{X},         \shortstack{Y}              }   ]{db}{db.txt} \begin{table}[t]   \caption{Database file}   \centering   \DTLdisplaydb{db} \end{table}     Any advice, please? Within a set of directories, how do I find a file whose name includes a given string, such as "abcde"? How do I connect to a MySQL Database in Python? How do I connect to a MySQL database using a python program? Why does US Robotics destroy Lanning's house? Shortly after the death of Dr. Lanning, Detective Spooner travels to the doctor's house to look for clues.  While he is searching the house a demolition bot (which had been programmed to demolish the house the next day) goes on a rampage and destroys the house with Detective Spooner in it.   The house is fully furnished and appears to be in good condition. Why would US Robotics want to destroy the house with everything in it? Why not sell the house and everything inside? My script (should) acts differently, depending on the presence of the data in the input stream. So I can invoke it like this:  $ my-script.sh   or:  $ my-script.sh &lt;&lt;-MARK     Data comes...     ...data goes. MARK   or:  $ some-command | my-script.sh   where two last cases should read the data, while first case should notice the data is missing and act accordingly.  The crucial part (excerpt) of the script is:  #!/bin/bash local myData; read -d '' -t 0 myData;  [ -z "${myData}" ] &amp;&amp; {     # Notice the lack of the data. } || {     # Process the data. }   I use read to read input data, then option -d '' to read multiple lines, as this is expected, and the -t 0 to set timeout to zero. Why the timeout? According to  (typing left unchanged; bold is mine):     -t timeout time out and return failure if a complete line of input is               not read withint TIMEOUT seconds.  The value of the TMOUT               variable is the default timeout.  TIMEOUT may be a               fractional number.  If TIMEOUT is 0, read returns success only               if input is available on the specified file descriptor.  The               exit status is greater than 128 if the timeout is exceeded   So I in case 2 and 3 it should read the data immediately, as I understand it. Unfortunately it doesn't. As -t can take fractional values (according to above man page), changing read line to:  read -d '' -t 0.01 myData;   actually reads the data when data is present and skips it (after 10ms timeout) if it is not. But it should also work when TIMEOUT is set to real 0.  Why it actually doesn't? How can this be fixed? And is there, perhaps, alternative solution to the problem of "act differently depending on the presence of the data"?  UPDATE  Thanks to @Isaac I found a misleading discrepancy between quoted on-line version and my local one (normally I do not have locale set to en_US, so help read gave me translation which I couldn't paste here, and looking up for on-line translation was faster than setting new env---but that caused the whole problem).  So for 4.4.12 version of Bash it says:     If TIMEOUT is 0, read returns               immediately, without trying to read any data, returning               success only if input is available on the specified               file descriptor.   This gives a little bit different impression than "If TIMEOUT is 0, read returns success only if input is available on the specified file descriptor"---for me it implied actually an attempt to read the data.  So finally I tested this and it worked perfectly:  read -t 0 &amp;&amp; read -d '' myData;   The meaning: see if there's anything to read and if it succeed, just read it.  So as to base question, the correct answer was provided by Isaac. And as to alternative solution I prefer the above "read &amp;&amp; read" method. Adjective for someone who exaggerates emotions to get sympathy