Here’s a small bash script. It checks if the given word is in dictionary and if not, assuming that it contains only a single character error, gives suggestions.
grep -i "^$word$" /usr/share/dict/words > /dev/null
if [ $? -eq 0 ]; then
echo "Word in dictionary";
echo "Word not in dictionary. Suggestions:"
for i in $(seq 1 $l);
regw=`echo $word | sed s/././$i`
grep -i "^$regw$" /usr/share/dict/words
This was actually a question i had in Tux of War, a shell scripting competition organized as a part of tathva at NIT Calicut. I got the sed expression from stackoveflow. It replaces just one letter of the word with ‘.’ in order in aloop, so that it would be a valid regex in grep to find the word suggestions.
I’m happy that my attempt works and I’m also sure there must be an efficient and easy method to do this! 😀
Setting up Archlinux is fun. For an interested beginner, it’s an enlightening experience. You get to know what package are needed to build and run your system, step by step, and it also gives this good feeling of being in power. So recently, I tried to do a fresh Archlinux install. This was on the laptop, in which I already had a perfectly working Ubuntu already installed. Usually, on PC, connecting internet in the minimal environment of arch is as simple as connecting the Ethernet cable and forgetting it. But this time, I had only wireless to rely on. Since the mere thought of taking out the eth cable from those unimaginable knots behind the desktop is enough to give me the shivers, and since I had no previous experience setting up wireless in Arch, I was facing some troubles. I left the task after a few vain attempts in which I realised I should have taken care to select and install the necessary packages for wireless during installation of Archlinux core.
But leaving a task undone is annoying. Every time I boot up, the Archlinux entry in grub seemed to be looking at me hopefully, awaiting its turn to be a ready to use installation. So eventually this thought occurred to me: Why not use chroot in Ubuntu to fix all issues and get Archlinux working?
The little previous experience I had with chrooting into Archlinux was when I tried to remake the kernel image after update in the desktop. I was then positively amused by the fact that an internet connection set up in Ubuntu could well serve Archlinux and help it fetch the packages even in that environment. If it could fetch then, why not now? Let the hacking begin! (Bit too enthusiastic, I know 😀 )
As always, I looked up the Archlinux wiki on Changing Root and followed the instructions:
mount /dev/<device-or-partition-name> /mnt/arch
mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/
mount -t devpts pts dev/pts/
chroot . /bin/bash
With these, I was able to run a pacman -Syu and get the packages. I could also install wireless_tools and wpa_supplicant, the two packages which I should have selected during the installation for configuring wireless. Even then, configuring wireless was yet another adventure. Linux continues to be fun!