O'Reilly logo

Pro Bash Programming: Scripting the GNU/Linux Shell by Chris F.A. Johnson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 11Programming for the Command Line

This book is about programming with the shell, not about using it at the command line. You will not find information about editing the command line, creating a command prompt (the PS1 variable), or retrieving commands from your interactive history. This chapter is about scripts that will mostly be useful at the command line rather than in other scripts.

Many of the scripts in this chapter are shell functions. Some of them have to be that way because they change the environment. Others are functions because they are often used and are quicker that way. Others are both functions and stand-alone scripts.

Manipulating the Directory Stack

The cd command remembers the previous working directory, and cd - ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required