How can I add a count to this command:
How to test for minimum amount of items in inventory and execute a command if true
Grub rescue - error: unknown filesystem I have a multiboot system set up. The system has three drives. Multiboot is configured with Windows XP, Windows 7, and Ubuntu - all on the first drive. I had a lot of unpartitioned space left on the drive and was reserving it for adding other OSes and for storing files there in the future.  One day I went ahead and downloaded Partition Wizard and created a logical NTFS partition from within Windows 7, still some unpartitioned space left over. Everything worked fine, until I rebooted the computer a few days later.  Now I'm getting:    error: unknown filesystem.   grub rescue&gt;   First of all I was surprised not to find any kind of help command, by trying:    help, ?, man, --help, -h, bash, cmd, etc.  Now I'm stuck with non-bootable system. I have started researching the issue and finding that people usually recommend to boot to a Live CD and fix the issue from there. Is there a way to fix this issue from within grub rescue without the need for Live CD?  UPDATE  By following the steps from , I was able to boot to initramfs prompt. But not anywhere further than that.  So far from reading the manual on , I was able to see my drives and partitions using ls command. For the first hard drive I see the following: (hd0) (hd0,msdos6) (hd0,msdos5) (hd0,msdos2) (hd0,msdos1)  I now know that (hd0,msdos6) contains Linux on it, since ls (hd0,msdos6)/ lists directories. Others will give "error: unknown filesystem."  UPDATE 2  After the following commands I am now getting to the boot menu and can boot into Windows 7 and Ubuntu, but upon reboot I have to repeat these steps.    ls ls (hd0,msdos6)/ set root=(hd0,msdos6) ls / set prefix=(hd0,msdos6)/boot/grub insmod /boot/grub/linux.mod normal   UPDATE 3  Thanks Shashank Singh, with your instructions I have simplified my steps to the following. I have learned from you that I can replace msdos6 with just a 6 and that I can just do insmod normal instead of insmod /boot/grub/linux.mod. Now I just need to figure out how to save this settings from within grub itself, without booting into any OS.  set root=(hd0,6) set prefix=(hd0,6)/boot/grub insmod normal normal   UPDATE 4  Well, it seems like it is a requirement to boot into Linux. After booting into Ubuntu I have performed the following steps described in the :  sudo update-grub sudo grub-install /dev/sda   This did not resolve the issue. I still get the grub rescue prompt. What do I need to do to permanently fix it?  I have also learned that drive numbers as in hd0 need to be translated to drive letters as in /dev/sda for some commands. hd1 would be sdb, hd2 would be sdc, and so on. Partitions listed in grub as (hd0,msdos6) would be translated to /dev/sda6.  UPDATE 5  I could not figure out why the following did not fix grub:  sudo update-grub sudo grub-install /dev/sda   So I downloaded  based on an answer from  post. That seemed to do the trick after I picked the "Recommended Repair (repairs most frequent problems)" option. Find all solutions to $x^2\equiv 1\pmod {91},\ 91 = 7\cdot 13$ Factorial identity $n!=1+(1-1/1!)n+(1-1/1!+1/2!)n(n-1)+\cdots$ Show that $\displaystyle{n!=1+\left(1-\frac1{1!}\right)n+\left(1-\frac1{1!}+\frac1{2!}\right)n(n-1)+\cdots}$. I can't figure out how this can be solved. I tried to use the binomial theorem but I couldn't prove it. Any help will be greatly appreciated. How can I synchronize my two Mac Computers? As the title says, how can I make this shape without resorting to a Boolean operation?    This is obviously a very simple example, but I find myself needing to do something like this relatively often when modelling.  Despite using Blender for a couple of years, and considering myself an intermediate to possibly advanced user, I still know of no easy way to make this kind of indentation in an object.  Obviously, if you are looking to make an indentation in the middle of the surface, you can simply select a face and extrude down. As you will know, this does not work at the edge of the surface.  I can create this shape using loop cuts, deleting the faces and then using snap to edge to extrude the edges down to the same level (and then filling in the faces), but it feels cumbersome and a lot of work for what feels like it should be very simple. PHP Change Array Keys Is there a way to change all the numeric keys to &quot;Name&quot; without looping through the array (so a php function)? [     0 =&gt; 'blabla',     1 =&gt; 'blabla',     2 =&gt; 'blblll',     // etc ... ] Prove that $\prod_{k=1}^{n-1}\sin\frac{k \pi}{n} = \frac{n}{2^{n-1}}$ Using $\text{n}^{\text{th}}$ root of unity  $$\large\left(e^{\frac{2ki\pi}{n}}\right)^{n} = 1$$  Prove that   $$\prod_{k=1}^{n-1}\sin\frac{k \pi}{n} = \frac{n}{2^{n-1}}$$ Do I have to buy a second wildcard certificate for a subdomain? We already have a wildcard certificate for *.mycompany.com. Our network has hosts that are only reachable internally. All of them belong to the internal.mycompany.com subdomain. There is a private server with the host name server.internal.mycompany.com on which I deployed our wildcard certificate.  When I visit the web server I get a host name mismatch error. Do I really have to get another wildcard certificate for *.internal.mycompany.com or is there another (free!?) way to use our wildcard certificate for all of our subdomains and its subdomains without getting an error in the browser? Event button as a module or as user program? How can I solve this quantum mechanical "paradox"? Let a (free) particle move in $[0,a]$ with cyclic boundary condition $\psi(0)=\psi(a)$. The solution of the Schrödinger-equation can be put in the form of a plane wave. In this state the standard deviation of momentum is $0$, but $\sigma_x$ must be finite. So we find that $\sigma_x\sigma_p=0$. Is something wrong with the uncertainty principle? Powering a WS2812B strip I'd like to assign a frequently used string to a shortcut key, so when I press it, it types it in whatever application I'm in. So for example, when I type Shift-F12, it types "This is wonderful!" in whatever Gnome app I'm in at that time. I am considering to create a wiki/blog for most of my study notes that I have made or taken digitally.  Also, for the handwritten and rough ones I am thinking about storing them in my GitHub repository.  Is this a good idea? How do professionals in academia and PhD students organise their notes?  Also, should I keep my notes publicly available?  Edit: The main purpose of keeping my notes public is to have them readily available and searchable of myself and my immediate peers in college. If that benefits someone else, I will be more than glad to have helped.   Update regarding having a blog/wiki: I was thinking about having stuff regarding my take on a certain topic or similar rather than just straightaway putting mugged up lecture notes. (as I mentioned in a comment)  So basically, as I go along a certain topic whatever interesting I find, I post  it. Also I will put in links to papers, books and other interesting literature on the topic that might be helpful while studying the topic. This seems easier to deal with and also serves as a way to track my current interests and/or workflow. Laurent series expansion Show that $8 \mid (a^2-b^2)$ for $a$ and $b$ both odd I need to periodically run a command that ensures that some text files are kept in Linux mode. Unfortunately dos2unix always modifies the file, which would mess file's and folder's timestamps and cause unnecessary writes.   The script I write is in Bash, so  I'd prefer answers based on Bash. How many people can the TARDIS transport? The interior of a TARDIS is much larger than its exterior, but how many occupants can it transport? Winter Bash 2014 closing remarks - ideas for next year we had a question like this, and  SE  members have supported one this year, and nobody seems to have made one yet.  Hence:  What does everybody want for next year's Winter Bash? It's okay to repost old ideas that have already come up if you feel they haven't had enough attention (but please don't go just copy/pasting every  !).  A few ideas I can think of off the top of my head:   Moar hats! There's been plenty of time to get all the hats this year; it would be great if next year there'd be more to do. Keep secret hats secret-er. This could be pretty hard to do, but possibly by deleting/locking "how do I get secret hats" posts?   One idea per answer, please! Rstudio is duplicating commands in the command line First I tried to use integration: $$y=\lim_{n\to\infty}\frac{a^n}{n!}=\lim_{n\to\infty}\frac{a}{1}\cdot\frac{a}{2}\cdot\frac{a}{3}\cdots\frac{a}{n}$$ $$\log y=\lim_{n\to\infty}\sum_{r=1}^n\log\frac{a}{r}$$ But I could not express it as a riemann integral. Now I am thinking about sandwich theorem.  $$\frac{a}{n!}=\frac{a}{1}\cdot\frac{a}{2}\cdot\frac{a}{3}\cdots\frac{a}{t} \cdot\frac{a}{t+1}\cdot\frac{a}{t+2}\cdots\frac{a}{n}=\frac{a}{t!}\cdot\frac{a}{t+1}\cdot\frac{a}{t+2}\cdots\frac{a}{n}$$ Since $\frac{a}{t+1}&gt;\frac{a}{t+2}&gt;\frac{a}{t+1}&gt;\cdots&gt;\frac{a}{n}$ $$\frac{a^n}{n!}&lt;\frac{a^t}{t!}\cdot\big(\frac{a}{t+1}\big)^{n-t}$$ since $\frac{a}{t+1}&lt;1$, $$\lim_{n\to\infty}\big(\frac{a}{t+1}\big)^{n-t}=0$$ Hence, $$\lim_{n\to\infty}\frac{a^t}{t!}\big(\frac{a}{t+1}\big)^{n-t}=0$$ And by using sandwich theorem, $y=0$. Is this correct?