Chapter 10: Files, Directories and Scripts

Chapter 10: Files, Directories and Scripts

In this chapter, you will

  • Learn how to manage files and directories

  • Learn how to work with the shell

  • Understand how to write shell scripts

  • Review commonly used shell commands

Although graphical user environments (GUIs) are an increasingly popular metaphor for interacting with computer systems, character user interfaces (CUIs) are a core feature of Solaris 9 because they provide a programmatic environment in which commands can be executed. Many operations on Solaris systems are performed in the context of a script, whether starting services at boot time or processing text to produce a report. Indeed, one of the key advantages of UNIX and UNIX-like environments over non-UNIX systems is the capability to combine large numbers of small commands in a CUI, in conjunction with pipes and filters, to create complex command sets that perform repetitive tasks.

Another key feature of Solaris 9 shells is the ability to write complex scripts that perform repetitive actions and can process various kinds of decision logic. There are many more commands available for the Bourne again shell than for MS-DOS batch files, which makes them quite powerful. However, Microsoft Windows Script is evolving to provide some of the advanced functionality featured by Solaris shell scripts. Script files are more dependent on understanding file permissions than just using the shell to enter commands, which makes them more complex. In this chapter, we review how to create executable scripts that can be used with the Bourne again shell. Finally, we focus on the advanced text processing features of the Solaris shell, and how these can be used when developing scripts.

Part I: Solaris 9 Operating Environment, Exam I