I have a output of the command df and using cut I have successfully extracted  22%. But the problem is I want only 22 not the %, as I will be comparing the value with another integer variable. How to do it in Bash ?
Here is what I tried doing:  #!/bin/sh res=`df | awk 'FNR == 2 { print $5 }'` res2=$((res+0))   Here is my error:     -bash: 53%: syntax error: operand expected (error token is "%")   I Googled 'string to int bash' which showed me $((res+0)) but it doesn't work due to the % in the string (53%). How do I convert it in such a way I can do an if statement such as the one below (but that works)?  if [ "$res2" -ge 50 ] then     echo "Your disk &gt;=50% full!" fi
How to delete file(s) in secure manner? A graph $G$ is bipartite if and only if $G$ can be coloured with 2 colours Consider this equation :   $$\sqrt{\left( \frac{dy\cdot u\,dt}{L}\right)^2+(dy)^2}=v\,dt,$$  where $t$ varies from $0$ to $T$ , and $y$ varies from $0$ to $L$.  Now how to proceed ?   This equation arises out of following problem :   A cat sitting in a field suddenly sees a standing dog. To save its life, the cat runs away in a straight line with speed $u$. Without any delay, the dog starts with running with constant speed $v&gt;u$ to catch the cat. Initially, $v$ is perpendicular to $u$ and $L$ is the initial separation between the two. If the dog always changes its direction so that it is always heading directly at the cat, find the time the dog takes to catch the cat in terms of $v, u$ and $L$.  See my solution below :   Let initially dog be at $D$ and cat at $C$ and after time $dt$ they are at $D'$ and $C'$ respectively. Dog velocity is always pointing towards cat.  Let $DA = dy, \;AD' = dx$  Let $CC'=udt,\;DD' = vdt$ as interval is very small so $DD'$ can be taken straight line.  Also we have $\frac{DA}{DC}= \frac{AD'}{ CC'}$ using triangle property.  $\frac{dy}{L}= \frac{dx}{udt}\\ dx = \frac{dy.udt}{L}$  $\sqrt{(dx)^2 + (dy)^2} = DD' = vdt \\ \sqrt{(\frac{dy.udt}{L})^2 + (dy)^2} = vdt $  Here $t$ varies from $0-T$, and $y$ varies from $0-L$. Now how to proceed? So I know umask can restrict privileged users, using this format umask ugo.  I understand that the read = 4, write = 2, and exec = 1. However, when I type umask, it returns 4 digits which is 0022 or 0073. I have no understanding of how does this work now because there is an extra digit. What is that extra digit and what does 0022 mean? Can $\pi$ or $e$ be a root of a polynomial with algebraic coefficients? Since $\pi$ and $e$ are transcendental, neither can be the root of a polynomial with rational coefficients. However, it is easy to construct a polynomial transcendental coefficients (with $\pi$ or $e$ as one of it's roots), namely $(x-\pi)$ and $(x-e)$. However, is it possible to construct a finite polynomial (one of whose roots is $\pi$ or $e$) with only algebraic coefficients? (i.e. something such as $y=x^5-(\sqrt 2 -1)x^2+x$ .) A polynomial with only radical coefficients would be the best.  P.S. The polynomial doesn't necessarily need to have BOTH $\pi$ and $e$ as it's roots, just one is interesting enough. What are the SEO rules for HTML 5? What are the rules of engagement with respect to SEO in HTML 5?  Examples of things we have been mulling over with no conclusion:   Are you penalised for not using &lt;head&gt; and &lt;body&gt; tags? Do links in &lt;nav&gt; blocks get prioritised for follows? With &lt;aside&gt; (no bside though), &lt;section&gt;, &lt;summary&gt; and &lt;details&gt; which ones carry the most weight for content, one-liner descriptions and keyword tags are there search engine implications? If you use CSS to put a &lt;footer&gt; element at the top and a &lt;header&gt; element at the bottom (not that you would but it may be construed as such by an incomplete spider implementation)? Does the use of placeholder attributes on &lt;input&gt; show you are more user focused?   At the minute we are haphazardly pinning the content on the donkey with regard to tag usage but would be interesting to know if anyone has any insight into the "correct" tags to use with regards to SEO. Why are we using the squared residuals instead of the absolute residuals in OLS estimation?  My idea was that we use the square of the error values, so that residuals below the fitted line (which are then negative), would still have to be able to be added up to the positive errors. Otherwise, we could have an error of 0 simply because a huge positive error could cancel with a huge negative error.  So why do we square it, instead of just taking the absolute value? Is that because of the extra penalty for higher errors (instead of 2 being 2 times the error of 1, it is 4 times the error of 1 when we square it). Sometimes, I find that it is useful to do a Clay Render for my model, where all of the materials render with a single common "clay"-like material (see example image below). In the past, I have done this by:   Selecting all of my objects by using the A hotkey Manually deselecting the World object, camera, and lights in the Outliner Linking materials using Ctrl+L Manually setting to the same material in the Properties>Materials menu Render like normal   When I was done with my Clay render, I would revert to the old version by pressing Ctrl+Z a few time. However, this is a rather clunky solution, since I can't make any edits in the clay version without losing my old materials/textures data.  Is there a better way to do Clay renders, either with an addon or through some other technique such that I can make edits to my model and not lose my materials? If at all possible, I would like a single setting that allows me to quickly toggle clay-mode on and off in the same file.  Example "Clay Render": 3d transforms on SVG element Grep in couple thousands files I have directory with cca 26 000 files and I need to grep in all these files. Problem is, that I need it as fast as possible, so it's not ideal to make script where grep will take name of one file from find command and write matches to file. Before "arguments list too long" issue it took cca 2 minutes to grep in all this files. Any ideas how to do it? edit: there is a script that is making new files all the time, so it's not possible to put all files to different dirs. How to pass parameters in batch file and zip the file using 7z.exe? I need to create a batch file as per below requirements  1) pass path1 &amp; path2 while running the batch file  exl: testrun.bat E:\ERP\test1.txt E:\ERP\header.txt  2) Need to store these command line paths values in batch file  exl: var1=E:\ERP\test1.txt var2=E:\ERP\header.txt  3) zip the path1 using PKZIPW.exe or 7z.exe and create new o/p zip file  exl: 7z.exe u -tzip E:\Erp\Test1.zip var1  4) copy path2 in newly created o/p file  exl: copy /b var2+test1.zip E:\Erp\Final_output.zip Make "axis cs" the default coordinate system in a PGFPlots plot I would like to know if there is a way to specify axis cs to be the default coordinate system inside a plot in PGFPlots, so I don't have to type axis cs: in front of every coordinate pair. Here's a MWE that shows what I mean (the actual plot is irrelevant).  \documentclass{article}  \usepackage{pgfplots}  \begin{document}  \begin{tikzpicture}  \begin{axis}[               xmin=0,               xmax=80,               ymin=0,               ymax=80,               grid=major,              ]   \fill [green, opacity=0.5] (axis cs:14,14) -- (axis cs:80,47) -- (axis cs:80,80) -- (axis cs:47,80) -- cycle;   \fill [red, opacity=0.5] (0,0) -- (axis cs:80,0) -- (axis cs:80,47) -- (axis cs:14,14) -- (axis cs:47,80) -- (axis cs:0,80) -- cycle;   \draw [thick] (axis cs:47,80) -- (axis cs:14,14) -- (axis cs:80,47);  \end{axis} \end{tikzpicture}  \end{document} June 13th 2017 Microsoft blocked handling HTML markup in SharePoint calculated fields - how to get the same functionality back On June 13th 2017 all SharePoint calculated columns with HTML markup stopped working.   Basically the fields now render text (regardless of setting the data type to number). The gist of the notice from Microsoft () is:     In Microsoft SharePoint lists and libraries, calculated fields that   are running in the classic UI mode can be used to display results   based on Excel-like formulas. This is a long standing capability, and   is documented in Calculate data in lists or libraries.      Some users have added HTML markup or script elements to calculated   fields. This is an undocumented use of the feature, and we will begin   blocking execution of custom markup in calculated fields in SharePoint   Online from June 13, 2017 onwards. We are also providing this as a   configurable option for on-premises in SharePoint Server 2016 and   SharePoint Server 2013 via the June 2017 and subsequent Public   Updates.   As we don't have on premise SharePoint (online), we have to find an immediate work around, given that this impacts our processes and thus, business.   Is anyone aware of third party applications that will allow for HTML, script markup (that works with SP online)? Array index out of bound behavior Why does C/C++ differentiates in case of array index out of bound #include &lt;stdio.h&gt; int main() {     int a[10];     a[3]=4;     a[11]=3;//does not give segmentation fault     a[25]=4;//does not give segmentation fault     a[20000]=3; //gives segmentation fault     return 0; }  I understand that it's trying to access memory allocated to process or thread in case of a[11] or a[25] and it's going out of stack bounds in case of a[20000]. Why doesn't compiler or linker give an error, aren't they aware of the array size? If not then how does sizeof(a) work correctly? How do I undo the most recent local commits in Git? Error AL lib: UpdateDeviceParams: Failed to set 44100hz, got 48000hz instead. What can I do? I have Win 10 and when I open Blender I have the error:     AL lib: UpdateDeviceParams: Failed to set 44100hz, got 48000hz instead How to block any app from being installed? My mom has an android tablet and she doesn't even know what a site is, her e-mail, or even the password of her facebook account. She's an average user. The internet is facebook in her eyes. She has no need for apps or anything, it's just, only, precisely facebook. All is facebook.  How can I completely disable installing apps in android so they can't be installed in any way or form, I mean, not by URL, not by clicking, not by app store, not even by another program. Just disable the entire thing altogether.  Doesn't need to be safe, have locks, passwords etc. I'm not trying to secure the device from intruders, attackers or robbers, I'm trying to secure it from its very own user.  Please help. I just had to remove two anti-virus apps that were opening adware pages when she tried to open facebook lite, and that's obviously a no-go, apps which she "had not installed." Clearly there's some voodoo going on here for them to just popup, or maybe she just did it unknowingly, but none of that's relevant. How can you just disable installs so this couldn't ever happen again? Why the interior of $\mathbb{Q}$ in $\mathbb{R}$ is empty? I'm having a really hard time trying to understand what the differences between a desktop environment and a window manager are?  EDIT: From this :  There are basically three layers that can be included in the Linux desktop: X Windows – This is the foundation that allows for graphic elements to be drawn on the display.  builds the primitive framework that allows moving of windows, interactions with keyboard and mouse, and draws windows. This is required for any graphical desktop. Window Manager – The Window Manager is the piece of the puzzle that controls the placement and appearance of windows. Window Managers include: , , , , , etc. Requires X Windows but not a desktop environment. Desktop Environment – This is where it begins to get a little fuzzy for some. A Desktop Environment includes a Window Manager but builds upon it. The Desktop Environment typically is a far more fully integrated system than a Window Manager. Requires both X Windows and a Window Manager.  Examples of desktop environments are , , ,  among others) sudo apt update &amp;&amp; sudp apt upgrade -y now shows the error message E:The package linux-modules-5.4.0-56-generic needs to be reinstalled. But I can't find an archive for it.  and nothing proceeds. How can I fix this problem? Thanks.