Archive for shell programming

Sharing Directories across Multiple Distros of Linux

I use seven different distros of Linux, which means there are seven home directories, which means seven different backups, and files scattered everywhere. I once tried have one shared partition that I mounted on each distro. With different desktops, different configuration files, there was hidden file chaos, and upgrades where a nightmare. I finally worked out a solution that works without depending on a network connection to share individual directories.

» Continue reading “Sharing Directories across Multiple Distros of Linux”

Share

Leave a Comment

Command Order of Precedence

The common misconception is that the shell always searches the PATH variable to find a command. The truth is that the shell may never get to the PATH variable before it has a name match. Before confusing the issue, let’s look at a simple example. If there is an alias that reads which=’whence -a’, and you enter which pwd, the which command is never executed. The shell first finds the alias, and then subsitutes the alias for the command, and starts the search all over. From this, we know that an alias has precedence over the PATH variable. So what is the order of precedence for finding the command?

» Continue reading “Command Order of Precedence”

Share

Comments (2)

The man Command Lies (Sometimes)

There are man pages with typographical errors, but that is not the issue of this post. Assuming you are using ksh or bash, how do you answer these questions:

  1. Is the man page for awk correct?
  2. Is the man page for pwd correct?

If you answered yes to both questions, you are wrong, but for different reasons. » Continue reading “The man Command Lies (Sometimes)”

Share

Leave a Comment

Trapped in Bourne Shell

Bash and KornShell offer features that are more powerful, and often, more efficient than Bourne Shell. Yet, I constantly see back tics (accent graves), instead of the easier to read format of $(…). I see the use of the expr command for math calculations in stead of (( … )). Even higher on the list of common sins is the use of [ ... ], instead of [[ ... ]]. It is my contention that the blame lies on introductory books and courses, which change the title to Bash Shell Programming, or KornShell Programming, but are nothing more than warmed-over Bourne Shell courses. So whey not use Bourne Shell syntax? After all, isn’t Bourne Shell the standard UNIX shell?

» Continue reading “Trapped in Bourne Shell”

Share

Comments (1)

KornShell’s Bad Rap

There are a number of myths surrounding KornShell that give it a bad rap. A history that few know about just adds to the confusion.  Can you answer the following questions:

  1. The Bourne Again Shell (bash) has its origin in which shell?
  2. UNIX uses which version of KornShell?
  3. Linux uses which version of KornShell?
  4. Who owns the copyright to KornShell?

If you know the answers to these questions, you are a KornShell guru, who does not perpetuate the myths. If not, you need to read on so that you know the truth about KornShell.

» Continue reading “KornShell’s Bad Rap”

Share

Comments (6)