Custom Search

Introduction

A shell is a command line interpretor. It takes commands and executes them. As such, it implements a programming language. The Bourne shell is used to create shell scripts -- ie. programs that are interpreted/executed by the shell. You can write shell scripts with the C-shell; however, this is not covered here.

Necessity of Structured Shell Programming

Shell scripts remain a staple of the business world.With high development costs, it is not practical to develop everything in a high-level language. Many business processes are simply a matter of following a series of steps, after which the results are labeled and archived.This is the very type of activity scripts are made to handle. Over time, shells have collected new features, often by copying the capabilities of other shells. In his book, The Humane Interface, Apple Macintosh interface designer Jef Raskin once spoke with a pilot regarding the design of the plane’s autopilot.The device was designed with five ways to enter coordinates.The reason for this design was to reduce training costs by emulating other autopilots. However, a pilot pointed out that the operator of the aircraft is responsible for knowing how to operate every piece of equipment, and that meant he had to know how to adjust the autopilot in each of the five ways.
Many shells, including Bash, have developed a mixture of features with specialized or arcane applications. Like the autopilot, it is not always clear how these features should be
used nor which features are provided primarily for compatibility.Too often, poorly designed scripts are all-but illegible to another programmer, or even to the same programmer a few months after a script was hastily assembled.
This presents a problem for serious business scripts.The cost of developing a highlevel language solution is high, but a disorganized shell script can be expensive to maintain
over time. As the needs of the business change, and the shell script is modified by successive generations of programmers, the problem escalates.
As a rule of thumb, business programs never go away.At one place I recently worked,what started off as a simple shell script used to print reports gradually evolved into a Web-based reporting system complete with personal customizations and secure access.
The original programmer had no idea what his script would become. Because of the essential openness and complex syntax of Bash, it’s to the benefit of any serious project to adapt some kind of standard. Bash is very forgiving, but the costs are not. For example, there are many ways to add 2 + 2 in Bash. Like the autopilot anecdote, it’s not practical to expect the programmers who maintain the scripts to have to deal with this kind of redundancy. Likewise, shell word quoting is sometimes optional, sometimes required, depending on the context. A command that works with one form of quotation can suddenly stop working when different data appears in the quotes. Issues like shell word quoting, specialized capabilities, or portability features, when abused, can lead to increased maintenance and long-term development costs.

The Origin of Linux

The Linux operating system was created as a hobby by a young student, Linus Torvalds, at the University of Helsinki in Finland. Linus, interested in the Unix clone operating system Minix, wanted to create an expanded version of Minix with more capabilities. He began his work in 1991 when he released version 0.02 and invited programmers to participate in his project.Version 1.0 was released in 1994.
Linux uses GNU General Public License (GPL) and its source code is freely available to everyone. Linux distributions, CD-ROMs with the Linux kernel and other software ready for installation, do not have to be free, but the Linux source code must remain available. Making source code available is known as distributing open source. The word “Linux” is properly pronounced using a Swedish accent, making it difficult to say in North America. It is most often pronounced with a short “i” and with the firstsyllable stressed, as in LIH-nicks, but it is sometimes pronounced LYE-nicks (the anglicized “Linus’ Unix”) or LEE-nucks. Strictly speaking, Linux refers to the operating system kernel that starts and manages other programs and provides access to system resources.The various open source shells, compilers, standard libraries, and commands are a part of another project called GNU. The GNU project was started by the Free Software Foundation (FSF) as an attempt to create a free version of Unix.The main Linux C compiler, gcc, is a part of the GNU project. There is also a GNU kernel project, but the Linux kernel has largely superseded thiseffort.
X Windows is also not strictly a part of Linux. Xfree86, the open source version of X Windows, was adapted to the Linux operating system and was released under a different license.

Running Windows Software on Linux: Wine

Wine is a Windows compatibility layer that will allow you to run many Windows applicationsnatively on Linux। Though you could run the Windows operating system on it, the actualWindows operating system is not required. Windows applications will run as if they wereLinux applications, able to access the entire Linux file system and use Linux-connected devices.Applications that are heavily driver dependent, such as graphic-intensive games, most likelywill not run. Others, such as newsreaders, which do not rely on any specialized drivers, mayrun very well. For some applications, you may also need to copy over specific Windows DLLsfrom a working Windows system to your Wine Windows system32 or system directory.To install Wine on your system, search for wine on you distributions repositories. Forsome distributions you may have to download wine directly from winehq.org. Binaries forseveral distributions are provided. Once installed, a Wine menu will appear in the Applications menu. The Wine menuholds entries for Wine configuration, the Wine software uninstaller, and the Wine filebrowser, as well as a regedit registry editor, a notepad, and a Wine help tool.To set up Wine, a user starts the Wine Configuration tool. This opens a window withpanels for Applications, Libraries (DLL selection), Audio (sound drivers), Drives, DesktopIntegration, and Graphics. On the Applications panel you can select which version ofWindows an application is designed for. The Drives panel will list your detected partitions,as well as your Windows-emulated drives, such as drive C:. The C: drive is really just adirectory, .wine/drive_c, not a partition of a fixed size. Your actual Linux file system will belisted as the Z: drive.Once configured, Wine will set up a .wine directory on the user’s home directory (thedirectory is hidden, so enable Show Hidden Files in the file browser View menu to displayit). Within that directory will be the drive_c directory, which functions as the C: drive,holding your Windows system files and program files in the Windows and Program File subdirectories. The System and System32 directories are located in the Windows directory.Here is where you place any needed DLL files. The Program Files directory will hold yourinstalled Windows programs, just as they would be installed on a Windows Program Files directory.To install a Windows application with Wine, you can either use the Wine configurationtool or open a Terminal window and run the wine command with the Windows applicationas an argument. The following example installs the popular newsbin program: $ wine newsbin.exe To install with the Windows Configuration tool, select the Applications panel and thenclick Add.Some applications, such as newsbin, will also require that you use certain DLL files froma working Windows operating system. The DLL files are normally copied to the user’s .wine/drive_c/Windows/system32 directory.Icons for installed Windows software will appear on your desktop. Just double-click anicon to start up the application. It will run normally within a Linux window, as would anyLinux application.Installing Windows fonts on Wine is a simple matter of copying fonts from a Windowsfont directory to your Wine .wine/drive_c/Windows/fonts directory. You can just copy anyWindows .ttf file to this directory to install a font. You can also use the Microsoft commonweb fonts available from fontconfig.org (this will require cabextract to extract them).Wine will use a stripped-down window style for features like buttons and the title bar. Ifyou want to use the XP style, download and install the Royal theme from Microsoft. Keep inmind, however, that supporting this theme is very resource intensive and will likely slowdown your system.


Setting Up Windows Network Access: Samba

You may need to let a Windows computer access a Linux system or vice versa. Windows, because of its massive market presence, tends to benefit from both drivers and applications support not found for Linux. Though there are equivalent applications on Linux, many of which are as good or better, some applications run best on Windows, if for no other reason than that the vendor only develops drivers for Windows. One solution is to use the superior server and storage capabilities of Linux to manage and hold data, while using Windows systems with their unique applications and drivers to run applications. For example, you can use a Linux system to hold pictures and videos, while using Windows systems to show or run them. Video or pictures can be streamed through your router to the system that wants to run them. In fact, many commercial DVR systems use a version of Linux to manage video recording and storage. Another use would be to enable Windows systems to use devices like printers that may be connected to a Linux system, or vice versa. To allow Windows to access a Linux system and Linux to access a Windows system, you use the Samba server. Samba has two methods of authentication, shares and users, though the shares method has been deprecated. User authentication requires that there be corresponding accounts in the Windows and Linux systems. You need to set up a Samba user with a Samba password. The Samba user should be the same name as an established account. The Windows user and Samba user can have the same name, though a Windows user can be mapped to a Samba user. A share can be made open to specific users and function as an extension of the user’s storage space. On most current distributions, Samba user and password information are kept in tdb (trivial data base) Samba database files, which can be edited and added to using the pdbedit command. To set up simple file sharing on a Linux system, you first need to configure your Samba server. You can do this by directly editing the /etc/samba/samba.conf file. If you just edit the /etc/samba/samba.conf file, you first need to specify the name of your Windows network. Samba provides a configuration tool called SWAT that you can use with any browser to configurae your Samba server, adding users and setting up shares. Some distributions, like Ubuntu, set up Samba automatically. KDE also provides Samba configuration. Once set up, both GNOME and KDE allow you to browse and access Samba shares from your desktop, letting you also access shared Windows directories and printers on other systems. On GNOME click the Network and then the Windows Network icon on the My Computer window. You will see an icon for your Windows network. On either GNOME or KDE you can enter the smb: URL in the a file manager window to access your Windows networks. When a Windows user wants to access the share on the Linux system, they open their My Network Places (Network on Vista) and then select Add a network place to add a network place entry for the share, or View workgroup computers to see computers on your Windows network. Selecting the Linux Samba server will display your Samba shares. To access the share, the user will be required to enter the Samba username and the Samba password. You have the option of having the username and password remembered for automatic access.

Desktop Theams in Linux

On GNOME, you use the Themes Preferences tool to select or customize a theme। Themes control your desktop appearance। When you open the Theme tool, a list of currently installed themes is shown। The GNOME theme is initially selected। You can move down the list to select a different theme if you wish। If you have downloaded additional themes from sites like art.gnome.org, you can click the Install button to locate and install them. Once installed, the additional themes will also be displayed in the Themes Preferences tool’s listing. If you downloaded and installed a theme or icon set from the Fedora repository, it will be automatically installed for you. The true power of Themes is in the ability it provides users to customize any given theme. Themes are organized into three components: controls, window border, and icons. Controls covers the appearance of window and dialog controls such as buttons and slider bars. Window border specifies how title bars, borders, and window buttons are displayed. Icons specify how all icons used on the desktop are displayed, whether on the file manager, desktop, or the panel. You can mix and match components from any installed theme to make your own theme. You can even download and install separate components like specific icon sets, which you can then use in a customized theme. Clicking the Customize button will open a Themes Details window with panels of the different theme components. The ones used for the current theme will be already selected. In the control, window border, and icon panels you will see listings of the different installed themes. An additional Color panel lets you set the background and text colors for windows, input boxes, and selected items. You can then mix and match different components like icons, window styles, and controls, creating your own customized theme. Upon selecting a component, your desktop automatically changes, showing you how it looks. One you have created a new customized theme, a Custom Theme entry will appear in the theme list. To save the customized theme, click the Save Theme button. This opens On KDE, you can select the Password panel in the Security entry on the KDE Control Center. Here you can select a picture for your account. Contact information is handled by other applications, like Kontact for mail and user information.