Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • You can also make that a function and have several configuration directories, that is what I am currently doing, have a look at my bashrc at github.com/jdevera/dotfiles/blob/master/bashrc Commented Feb 22, 2011 at 9:05
  • If you're going to quote the conf_file variable in your source command, it's probably good practice to quote it in your [[ pseudo-command, too. This apparently isn't actually required, since bash seems to expand variables differently inside of it than out, but it would help prevent an accidental removal of them in other places... To wit: compare: foo='test this thing'; touch $foo; [[ -f $foo ]] && echo true || echo false versus foo='test this thing'; touch "$foo"; [[ -f $foo ]] && echo true || echo false (run these from an empty directory for improved sanity) Commented Feb 22, 2011 at 10:21
  • I always quote outside [[ but never inside, since there is not splitting or glob expansion inside [[. mywiki.wooledge.org/BashFAQ/031 Commented Feb 23, 2011 at 15:30