I have a directory with git inside and git branch gives me the following output:  $ git branch   branch1 * branch2   master   The * marks the current branch. I would like to use this output in a script. So I loop over the lines like this:  $ for line in $(git branch); do echo "${line}"; done; branch1 README.txt branch2 master   Questions:  What happened to the * and why do I see README.txt[1]?  How can I loop over the lines returned by a normal git branch exactly as they are, with * and a space?  P.S.: I am on a Mac right now.  [1] (or any other file in the repository but this one only has one file "README.txt")
Or, an introductory guide to robust filename handling and other string passing in shell scripts.  I wrote a shell script which works well most of the time. But it chokes on some inputs (e.g. on some file names).  I encountered a problem such as the following:   I have a file name containing a space hello world, and it was treated as two separate files hello and world. I have an input line with two consecutive spaces and they shrank to one in the input. Leading and trailing whitespace disappears from input lines. Sometimes, when the input contains one of the characters \[*?, they are replaced by some text which is is actually the name of files. There is an apostrophe ' (or a double quote ") in the input and things got weird after that point. There is a backslash in the input (or: I am using Cygwin and some of my file names have Windows-style \ separators).   What is going on and how do I fix it?
Today I got what I presume was the update that should take care of Spectre and Meltdown. That didn't go very well. What do I do now? See screen photo.    I can't boot the 4.4.0-108-generic kernel because of a kernel panic. I'm running 16.04 on an Intel Core i5-4670K CPU @ 3.40GHz × 4. Showing that $\int\limits_{-a}^a \frac{f(x)}{1+e^{x}} \mathrm dx = \int\limits_0^a f(x) \mathrm dx$, when $f$ is even I have a question:     Suppose $f$ is continuous and even on $[-a,a]$, $a&gt;0$ then prove that   $$\int\limits_{-a}^a \frac{f(x)}{1+e^{x}} \mathrm dx = \int\limits_0^a f(x) \mathrm dx$$   How can I do this? Don't know how to start. Best Azure Service for Large no of SQLServer Databases What should we do about Stack Overflow-specific questions on Meta SE? What is difference between the options "autoclean", "autoremove" and "clean"? How do I drag and drop files into an application? I've seen this done in Borland's  environment, but I'm not sure how to go about it for a C# application I'm working on. Are there best practices or gotchas to look out for? Trackpad not working after update to Ubuntu 14.10 on Dell Inspiron 15R When I updated from 14.04 to 14.10 I noticed my track-pad cursor and left and right mouse clickers were not working. I have tried looking this issue up and can not find any solutions anywhere. If anyone could help me that would be amazing, I am using a wired mouse to my USB port for a temporary fix. I have a Dell Inspiron 15R. Electromagnetic waves can be shielded by a perfect conductor. What about gravitational fields or waves? Resolve build errors due to circular dependency amongst classes I often find myself in a situation where I am facing multiple compilation/linker errors in a C++ project due to some bad design decisions (made by someone else :) ) which lead to circular dependencies between C++ classes in different header files (can happen also in the same file). But fortunately(?) this doesn't happen often enough for me to remember the solution to this problem for the next time it happens again.  So for the purposes of easy recall in the future I am going to post a representative problem and a solution along with it. Better solutions are of-course welcome.     A.h  class B; class A {     int _val;     B *_b; public:      A(int val)         :_val(val)     {     }      void SetB(B *b)     {         _b = b;         _b-&gt;Print(); // COMPILER ERROR: C2027: use of undefined type 'B'     }      void Print()     {         cout&lt;&lt;"Type:A val="&lt;&lt;_val&lt;&lt;endl;     } };       B.h  #include "A.h" class B {     double _val;     A* _a; public:      B(double val)         :_val(val)     {     }      void SetA(A *a)     {         _a = a;         _a-&gt;Print();     }      void Print()     {         cout&lt;&lt;"Type:B val="&lt;&lt;_val&lt;&lt;endl;     } };       main.cpp  #include "B.h" #include &lt;iostream&gt;  int main(int argc, char* argv[]) {     A a(10);     B b(3.14);     a.Print();     a.SetB(&amp;b);     b.Print();     b.SetA(&amp;a);     return 0; } Equivalent of shell 'cd' command to change the working directory? cd is the shell command to change the working directory. How do I change the current working directory in Python? Do singularities have a "real" as opposed to mathematical or idealized existence? I was thinking of, for example a Schwarzchild metric at r=0, i.e. the gravitational singularity, a point of infinite density. I realise that there are different types of singularities--timelike, spacelike, co-ordinate singularities etc. In a short discussion with Lubos, I was a bit surprised when I assumed they are idealized and I believe he feels they exist. I am not a string theorist, so am not familiar with how singularities are dealt with in it.  In GR, I know the Penrose-Hawking singularity theorems, but I also know that Hawking has introduced his no-boundary, imaginary time model for the Big Bang, eliminating the need for that singularity. Are cosmic strings and other topological defects singularities or approximations of them (if they exist).  In what sense does a singularity exist in our universe? --as a real entity, as a mathematical or asymptotic idealization, as a pathology in equations to be renormalized or otherwise ignored, as not real as in LQG, or as real in Max Tegmark's over-the-top "all mathematical structures are real"? What size should the HMAC key be with SHA-256? I'm trying to generate a secret key to be used for HMAC SHA-256 signature processing. I've seen many sample of keys with variable length from 32 characters to 96 characters.  What is the ironclad rule for this key size? What are badges? How do users get badges? How can users get tag badges? Can badges be lost/revoked/taken away after they are awarded? If so, how and when? How can I suggest a new badge?   For more information, see &quot;&quot; and the  in the . Convert NSDate to NSString How do I convert, NSDate to NSString so that only the year in @"yyyy" format is output to the string? MySQL remove duplicates from big database quick I am building a blog type page, and I want to load items into the page as the user scrolls down, much like Google Reader, or Soup.io. How would you go about achieving this effect? I've seen some examples which read the height of the page, and have an onScroll even attached to the window so that as the user scrolls down we can test to see if they've scrolled down far enough to warrant loading more items. Soup.io's implementation seems to remove the old items as you scroll down so that the browser isn't dealing with an ever-increasingly large DOM tree. Which javascript libraries would be best suited to this task? How did Princess Leia survive this? In the Last Jedi movie, there is a scene where      her spaceship is taken down, Princess Leia is thrown into outer space, and seen floating there, frozen.    However, she manages to survive this, while any ordinary human being couldn't.   How did she manage this? Is this done by using the Force? Derivatives: enter "evaluated at" vertical bar with multiple values as subscripts Sorry for the long title, but how do I enter evaluated at (for a derivative), with multiple valuation criteria at the bottom of the the big | line?  Thanks! How do I change the default wifi network that Ubuntu connects to on startup? There is an unsecured public wifi network in my range, as well as my own home WPA secured wifi that I want to use by default. However, on startup Ubuntu always connects to the unsecured one. Sometimes I forget to reconnect to the other one, which is very dangerous.   I am running a default setup of Ubuntu Destkop 11.10 with Gnome 3. I have looked under network settings but I can't find a 'default' option. Create model from XYZ data points