What is the portable and canonical way to test if variable is empty/undefined in a shell script? It should work in all sh-like shells. What I do now is something like:  if [ -z "$var" ] ; then     ...   and for reverse, doing something when variable is not empty/undefined:  if [ -n "$var" ] ; then     ...   And while these work for the scripts I write now, I'd like to know a way, that will work in any reasonably compatible sh-like shell, even on some more obscure environment than a Linux PC with GNU userland and bash or dash.  I'm looking for an "expert answer" from someone who is experienced in different shell environments and knows the pitfalls of different ways of doing things, not an opinion like "that should work".
I see this often in the build scripts of projects that use autotools (autoconf, automake).  When somebody wants to check the value of a shell variable, they frequently use this idiom:  if test "x$SHELL_VAR" = "xyes"; then ...   What is the advantage to this over simply checking the value like this:  if test $SHELL_VAR = "yes"; then ...   I figure there must be some reason that I see this so often, but I can't figure out what it is.
Mathematica won't give eigenvectors but Wolfram Alpha will? What am I doing wrong? How to determine the point of intersection of two lines? I have two lines say P1( 0, -1, 0, -1 ) and P2( -1, 0, 0, -1 ). Since I'm working in 2D, there is no Z component. The x,y,z components are normals and the w component is the distance from origin. I am not given the origin or any points on the line.  What method should I use to programmatically determine the point of intersection for these two lines? How can I evaluate $\sum_{n=0}^\infty(n+1)x^n$? How can I evaluate $$\sum_{n=1}^\infty\frac{2n}{3^{n+1}}$$? I know the answer thanks to , but I'm more concerned with how I can derive that answer. It cites tests to prove that it is convergent, but my class has never learned these before. So I feel that there must be a simpler method.  In general, how can I evaluate $$\sum_{n=0}^\infty (n+1)x^n?$$ Doubt related to a theorem in congruences of Chapter 5 of Apostol Introduction to analytic number theory I am self studying number theory from Introduction to Analytic number theory by Apostol.   I have a doubt in one argument of proof of Theorem 5.14 and I am posting its image.      My doubt is in 2nd line of 2 nd paragraph how Apostol writes - If y is a solution of (5) then ay $\equiv $ at ( mod m) . How does y being a solution of (5) implies that?       Can someone please help The pigeonhole principle - how to solve questions like that? We have two sequences , $(a_i)_{i=1}^{2n}$ and $(b_i)_{i=1}^{2n}$ such that  $1\leq a_i, b_i\leq n$ for every $i$.  Show that there are two sets of indexes $I, J \subseteq \left \{ 1,2, ... 2n \right \}$ such what $\sum_{i\in I}a_i=\sum_{j\in J}b_j$.  Well, the question didn't say anything about those sets being empty but I believe that's not what they meant. I don't know that to do with questions like these. There are obviously much more subsets that possible sums ($2^{2n}-1$ compared to $2n^2$) but it doesn't really help.  I'd be glad to hear ideas, hints or solutions. I am typing a command, I remember I have to check something, if I press Ctrl+U the command disappears and I can type something else, but then the command I was typing is not in the history.  Is there a way to recover that command, or a different shortcut that I can press to save somewhere the command? I want to kill all running processes of a particular user from either a shell script or native code on a Linux system.  Do I have to read the /proc directory and look for these?  Any ideas? Is there a dynamic mapping of the pids under UIDs in Linux? Isn't this in the proc?  If not, then where is this list maintained? Should I read from it? Also where is the static list of all UIDs in the system so I can validate this this user exists and then proceed to kill all processes running under it? Representing several points with same coordinates on map using ArcGIS Desktop? I'm working on Arcgis 10.  I have a point shapefile representing events with several points having coinciding coordinates (They have the same coordinates). For representing them in a dynamic way, I found a nice way - .  Problem is: I was asked to produce a static (paper) map of the events. Is there a tool that can take these events and shift them apart a bit so all will be seen?  (I know that spreading them about will alter their coordinates, but I am prepared to do so on a duplicate shapefile for the display on the map). How can I share a directory with an another user? I don't want the shared folder to be accessible by anyone on the system, I want it to be accessible just to a restricted set of users.  How to I do that? In the Stack Exchange Android App v1.0.7 1.0.33 (with a HTC One running Android 4.4.2), the answer count for a question you're viewing is displayed in two places:   In the label of the answer tab:   At the bottom of the question tab:    I've noticed that these counts don't reliably update when new answers arrive.   If you refresh the question tab, neither count updates. If you refresh the answer tab, the second count will be updated, but the answer tab's count will not, leaving the two out of sync.   Refreshing either tab should probably update both counts!    Screenshots of the bug in action:    I waited for it to be answered. A while later, the question now has an answer.    The tab still says 0 answers though. Switching back to the question tab, , but the tab count still doesn't. Can a Tourist from a VWP country carry (Rent/ Borrow) a gun in say Florida Looking to find out if it is legal to borrow or rent a gun from an individual(s) or company to use to either visit the various gun ranges or wildlife hunting in Florida.  I have a shotgun licence in the UK for hunting etc... but looking to do something similar in Florida without falling foul of any gun carrying laws in transit to any gun range or hunting area?  I know various friends in the US that would lend the guns while there but are they required to be with me while attending any event? Basically not looking to be tethered to any third party... Why isn't an upgrade to 20.04 from 18.04 available yet? When reading lens reviews on the Internet, I often find subjective statements about the image quality that a lens produces, such as "good contrast" or "sharp". The problem is that I don't think I am capable to actually see these qualities on an image. I don't even think I could tell the difference between a cheap kit lens and a top lens, if not by "this just looks better".  So my question is: without looking at sharpness tests and MTF curves, how do you learn to judge the quality of a lens based only on sample images? What are the characteristics you look for and what constitutes good or bad in each of them? Copying data over with rsync causes size discrepancies Test coverage for setCookies method I am adding cookie to my page in the controller using  ApexPages.currentPage().setCookies(new Cookie[]{CookieName});  When am trying to get the code coverage, my test class is not covering the above line.  How to get the code coverage for the above setcookie method in the test class. What are good basic statistics to use for ordinal data? Fundamental group of a torus with points removed How to convert a HEIF/HEIC image to JPEG in El Capitan? Let $T:V\to V$ be a linear map, where $V$ is an inner product space. Given $T^2=\frac{T+T^*}{2}$, prove that $T$ is normal and that $T=T^2$. Let $T:V\to V$ be a linear map, where $V$ is a finite-dimensional inner product space. Given $T^2=\frac{T+T^{*}}{2}$, I would like to prove that $T$ is normal and that $T=T^2$. The first part, to prove that $T$ is normal, is quite easy: from $T^2=\frac{T+T^{*}}{2}$ we'll have $\,T^{*}=2T^2 - T$, and as $TT^{*} = 2T^3 -T^2 = T^{*}T$. Now, I need to prove that $T=T^*$, then $T = T^2$ is immediate. I have been thinking about this question for some days and I can't figure out in what technique to prove that $T = T^{*}$. Why does boiling water in the microwave make a cup of tea go weird? When I boil water in the kettle, it makes a nice cup of tea.  Sometimes I need to use a microwave because a kettle isn't available.  I boil the water in the mug and it looks pretty normal, but when I drop in the teabag the water froths up and looks foamy.  I don't see what the chemical difference is here, so I assume it must be some physical difference.  I have noticed this with multiple types of tea and multiple microwaves, the results being consistent so it's not just a weird microwave or something like that.    What is the reaction here and how/why does it occur?  Here is a photo of the 'fizzy' looking tea just after dunking in the teabag.