shopt causes bash completion to stop working.

Couple of days, I added some scripts to my bash startup and suddenly realized that bash completions stopped working. This is tricky situation in bash to figure out what went wrong. So, I set my foot down to make sure that I find out the culprit. Thus I started with method of elimination. So, I started with nothing in .bashrc and kept adding my stuff in batches, until the said feature was broken. Once that happened I started removing the added ones, one by one, until my completion started working again.

So, Finally I got my culprit, which was:

shopt -s  dotglob extglob nullglob promptvars

In your case, the feature broken may be some other feature or the culprit may be some other statement, but the above procedure will help you identify the problem without much struggle.

Enhanced by Zemanta

First earning on the blog in the form of advertising

business,accounts,accountant,office,boss,manag...
Image via Wikipedia

Thanks to all my visitors, I was approached by some advitisers, which suited very well with the theme and philosophy of my blog and thus accepted the same. So, thanks to all my visitors, now my blog has earned its first income in the form of advertising.

Enhanced by Zemanta

Find all the missing paths in the PATH variable in bash script

Here is a simple script that will list out all the paths in the PATH variable that do not exist.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash -
#===============================================================================
#
#          FILE:  wrong_path.sh
#
#         USAGE:  ./wrong_path.sh
#
#   DESCRIPTION:  Show Directories in the PATH Which does NOT Exist
#
#       OPTIONS:  ---
#  REQUIREMENTS:  ---
#          BUGS:  ---
#         NOTES:  ---
#        AUTHOR:  Amit Agarwal (AKA), amit.agarwal@amit-agarwal.co.in
#       COMPANY:  Individual
#       VERSION:  1.0
#       CREATED:  09/20/2009 09:15:48 AM IST
#      REVISION:  ---
#===============================================================================

set -o nounset                              # Treat unset variables as an error

(IFS=:;for p in $PATH; do test -d $p || echo $p; done)