I am trying to read in a file using read in bash 3.2, but read seems to be converting any instance of multiple whitespace into a single space.  For example, the code below has two tabs between "hello" and "there", and three spaces between "today" and "world":  while read -r LINE; do     echo $LINE done &lt;&lt;&lt; "hello     there today   world"   However, when run, it outputs with only a space in between each set of words:  hello there today world   Instead, I'd like it to output the lines with whitespace preserved, e.g.:  hello       there today   world   Is there any way to do this? If not with read, then with something else?
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?
Take a screenshot of a webpage with JavaScript? Prove that the number of $\alpha\in\mathbb{F}_{27}$ such that $|A_\alpha|=26 $ equals 12. Let $\mathbb{F}_{27}$ denote the finite field of size 27. For each $\alpha\in\mathbb{F}_{27}$ , define $ A_{\alpha}$ $=$ { $ 1, 1+\alpha , 1+\alpha+{\alpha}^2 , 1+\alpha+{\alpha}^2+{\alpha}^3 , .... $} . Then  prove that  the number of  $\alpha\in\mathbb{F}_{27}$ such that $|A_\alpha|$=26 equals 12.  $ 0\in A_\alpha $ if and only if $\alpha\neq 0$ For the first proof , the multiplicative group of the field $\mathbb{F}_{27}$ is cyclic and its order is 26  , so there are 12 generators in that group.   Now  I need  to  show  that  $ 1+\alpha+{\alpha}^2+.. {\alpha}^{25} $ =0  , where order of $\alpha$=26 . Since   $\alpha ^{26}$ =1 ($\alpha$-1)(1+$\alpha$+${\alpha}^2$+...+${\alpha}^{25}$)=0 , since $\alpha\neq 1$  , So $ 1+\alpha+...+{\alpha}^{25} $ =0 My question is , can I write these last two  lines?  I mean are those two lines alright to write? If those two lines are invalid then I need some help to show  $ 1+\alpha+{\alpha}^2+..+{\alpha}^{25} $=0  .Thanks Proving the measure of an increasing sequence of measurable sets is the limit of the measures Show that if $A_1\subseteq A_2\subseteq A_3\subseteq\cdots$ is an increasing sequence of measurable sets (so $A_j\subseteq A_{j+1}$ for every positive integer $j$), then we have $$m\left(\bigcup_{j=1}^\infty A_j\right)=\lim_{j\to\infty}m(A_j)$$  Here is my proof: According to the $\sigma$-algebra property, $\bigcup_{j=1}^{\infty}A_j$ is a measurable set, so it makes sense to talk about $m(\bigcup_{j=1}^{\infty}A_j)$. Firstly, I prove that $\lim_{j\to\infty}m(A_j)\leq m(\bigcup_{j=1}^{\infty}A_j)$. This is because for any given positive integer $N$, $A_N\subseteq \bigcup_{j=1}^{\infty}A_i$, according to monotonicity, we have $m(A_N)\leq m(\bigcup_{j=1}^{\infty}A_i)$. Take the limit,we will have $\lim_{j\to\infty}m(A_j)\leq m(\bigcup_{j=1}^{\infty}A_j)$. Secondly, I prove that $m(\bigcup_{j=1}^{\infty}A_j)\leq \lim_{j\to\infty}m(A_j)$. For any given positive integer $N$, $\bigcup_{j=1}^N A_j = A_N$. According to monotonicity,we have $m\left(\bigcup_{j=1}^N A_j\right)=m(A_N)\leq \lim_{j\to\infty}m(A_j)$. Take the limit, we will have $m\left(\bigcup_{j=1}^\infty A_j\right) \leq \lim_{j\to\infty} m(A_j)$. Combine the above two arguments, we will see that $$m\left(\bigcup_{j=1}^\infty A_j\right)=\lim_{j\to\infty} m(A_j)$$$\Box$  The above is my proof, unlike many books, my proof does not use the property of countable additivity. So I doubt my proof is correct. Who can point out where are my mistakes? How I can automatically add a page if the total number of pages is odd? I need automatically add a blank page (also without document header, numbering and footer) at the end of the document, if the total numbers of pages is odd. How I can do that? And preferably without using any additional package. :) Showing that a finite abelian group has a subgroup of order m for each divisor m of n I have made an attempt to prove that a finite abelian group of order $n$ has a subgroup of order $m$ for every divisor $m$ of $n$.     Specifically, I am asked to use a quotient group-induction argument to show this.  I'd appreciate comments on the validity or lack thereof of my attempted proof below.  Let $G$ be a finite abelian group of order $n$ and let $m$ be a divisor of $n$.  The proposition is true for $n=1$, so we'll proceed by induction and assume $n \ge 2$.  Let $p$ be a prime dividing $m$ and let $x$ be an element of order $p$ in $G$ (which exists by Cauchy's Theorem for Abelian Groups).  By the induction hypothesis, $G/\langle x \rangle$ has a subgroup of order $\dfrac{m}{p}$.  This subgroup is of the form $H/\langle x \rangle$ for some $H \le G$.  Since $|H/\langle x \rangle| = \dfrac{m}{p}$, it follows that $H \le G$ has order $m$.  I chose to use a prime divisor of $m$, but I don't see why it wouldn't work to use any proper divisor of $m$.  Am I correct on this point?  Thanks, I appreciate the help. Understanding MCMC and the Metropolis-Hastings algorithm Over the past few days I have been trying to understand how Markov Chain Monte Carlo (MCMC) works. In particular I have been trying to understand and implement the Metropolis-Hastings algorithm. So far I think I have an overall understanding of the algorithm but there are a couple of things that are not clear to me yet. I want to use MCMC to fit some models to data. Because of this I will describe my understanding of Metropolis-Hastings algorithm for fitting a straight line $f(x)=ax$ to some observed data $D$:  1) Make an initial guess for $a$. Set this $a$ as our current $a$ ($a_0$). Also add $a$ at the end of the Markov Chain ($C$).  2) Repeat the steps bellow a number of times.  3) Evaluate current likelihood (${\cal L_0}$) given $a_0$ and $D$.  4) Propose a new $a$ ($a_1$) by sampling from a normal distribution with $\mu=a_0$ and $\sigma=stepsize$. For now, $stepsize$ is constant.  5) Evaluate new likelihood (${\cal L_1}$) given $a_1$ and $D$.  6) If ${\cal L_1}$ is bigger than ${\cal L_0}$, accept $a_1$ as the new $a_0$, append it at the end of $C$ and go to step 2.  7) If ${\cal L_1}$ is smaller than ${\cal L_0}$ generate a number ($U$) in range [0,1] from a uniform distribution  8) If $U$ is smaller than the difference between the two likelihoods (${\cal L_1}$ - ${\cal L_0}$), accept $a_1$ as the new $a_0$, append it at the end of $C$ and go to step 2.  9) If $U$ is bigger than the difference between the two likelihoods (${\cal L_1}$ - ${\cal L_0}$), append the $a_0$ at the end of $C$, keep using the same $a_0$, go to step 2.  10) End of Repeat.  11) Remove some elements from the start of $C$ (burn-in phase).  12) Now take the average of the values in $C$. This average is the estimated $a$.  Now I have some questions regarding the above steps:   How do I construct the likelihood function for $f(x)=ax$ but also for any arbitrary function? Is this a correct implementation of Metropolis-Hastings algorithm? How the selection of the random number generation method at Step 7 can change the results? How is this algorithm going to change if I have multiple model parameters? For example, if I had the model $f(x)=ax+b$.   Notes/Credits: The main structure of the algorithm described above is based on the code from an MPIA Python Workshop. Virtual Box Won't Accept .ISO To Install OS I'm tutoring high school students. I've always taught them that:     A charged particle moving without acceleration produces an electric as well as a magnetic field.   It produces an electric field because it's a charge particle. But when it is at rest, it doesn't produce a magnetic field. All of a sudden when it starts moving, it starts producing a magnetic field. Why? What happens to it when it starts moving? What makes it produce a magnetic field when it starts moving? Do I cast the result of malloc? In , someone suggested in a  that I should not cast the result of malloc. i.e., I should do this: int *sieve = malloc(sizeof(int) * length);  rather than: int *sieve = (int *) malloc(sizeof(int) * length);  Why would this be the case? How do I split a string, breaking at a particular character? Why does Benford's Law (or Zipf's Law) hold? Both  (if you take a list of values, the distribution of the most significant digit is rougly proportional to the logarithm of the digit) and  (given a corpus of natural language utterances, the frequency of any word is roughly inversely proportional to its rank in the frequency table) are not theorems in a mathematical sense, but they work quite good in the real life.   Does anyone have an idea why this happens?  (see also ) I'm trying to install the drivers to my wireless adapter ():   I have already tried the following:  sudo add-apt-repository ppa:hanipouspilot/rtlwifi sudo apt update sudo apt install rtl8192eu-dkms   But I'm getting the following error:  E: Unable to locate package rtl8192eu-dkms   I have also tried manually downloading and installing it, but I'm getting this:  make make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/4.6.0-kali1-amd64/build M=/root/Desktop/20140812_rtl8192EU_linux_v4.3.1.1_11320  modules make[1]: *** /lib/modules/4.6.0-kali1-amd64/build: No such file or directory.  Stop. Makefile:1323: recipe for target 'modules' failed make: *** [modules] Error 2   edit: lsusb output  root@kali:~# lsusb Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 004: ID 8087:07da Intel Corp.  Bus 001 Device 003: ID 1bcf:2c0e Sunplus Innovation Technology Inc.  Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub **Bus 003 Device 002: ID 2357:0107**   Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub What is the best term to describe the fact that most users have an initial dislike of any change to a UI even though it may really be net better over time?  Note: Question originally appeared I want to draw a TikZ matrix with its border and I would like to define the distance between most external matrix nodes and matrix border. Something like a matrix inner sep. If I change inner sep in matrix options declaration, all nodes inside the matrix also change its inner separation.      I know how to do it with fit library. I just want to know if its possible without it. How do I calculate a time delta in my Google Spreadsheets? Laravel 4.1 Run migrations and update configuration from package dependencies Is torque as fundamental a concept as force? I used to think that torque and force were equally “fundamental”. In other words, my understanding was that we usually use Cartesian coordinates in many common problems because it is a convenient system, so as a result instantaneous forces which act in straight lines seem “easier” mathematically but torques require some extra “baggage”. This baggage includes typically teaching that torque is defined in terms of force.  But if say we happened to choose polar coordinates for the problem the situation would appear the other way around. So it would be arbitrary if we chose to define forces in terms of torques instead.  But later on I learned that angular momentum is conserved independently of regular linear momentum (IIRC). Given the definitions of force &amp; torque as derivatives of momentum, this makes it seem much less certain that one should define either torque in terms of force or vice versa — it gives the impression they are more distinct than it first seemed.  That said, as far as I know a lot of physics is about defining &amp; describing “fundamental forces” — not “fundamental torques”.   So is choosing to use either force or torque as the basis of laws &amp; problems arbitrary? Or is there an actual fundamental rationale to when one or the other should be used? Error on Ubuntu boot up - "recovering journal" Trying to figure out what this means:    I got into the GRUB menu, chose Advanced Options, boot in recovery mode, login as root, and I did:  root@xps:~# sudo fsck -f / fsck from util-linux 2.27.1 e2fsck 1.42.13 (17-May-2015) /dev/nvme0n1p2 is mounted. e2fsck: Cannot continue, aborting.   Coincidentally, I am also seeing this fuzzy rainbow thing on the outside of desktop windows:    But now the machine won't even boot up at all. ASP.NET "special" tags The MathJax code in Mathematics Stack Exchange doesn't render after I updated to the new version (It used to):     App Version: 1.6.2.5 Device: iPhone 6s OS Version: Version 9.0 (Build 13A342)