/var
Whereas /usr holds static, read-only data, /var is for data which is written during
system operation and thus is variable data, such as log les or spooling data. For
an overview of the most important log les you can nd under /var/log/, refer
to Table A.2, “Log Files” (page 240).
/windows
Only available if you have both Microsoft Windows and Linux installed on your
system. Contains the Windows data available on the Windows partition of your
system. Whether you can edit the data in this directory depends on the le system
your Windows partition uses. If it is FAT32, you can open and edit the les in this
directory. For NTFS, openSUSE also includes write access support. However, the
driver for the NTFS-3g le system has limited functionality. Learn more in Sec-
tion “Accessing Files on Dierent OS on the Same Computer” (Chapter 23,
Copying and Sharing Files, ↑Reference).
18.2 Writing Shell Scripts
Shell scripts are a convenient way of doing all sorts of tasks: collecting data,
searching for a word or phrase in a text and many other useful things. The following
example shows a small shell script that prints a text:
Example 18.1 A Shell Script Printing a Text
#!/bin/sh ❶
# Output the following line: ❷
echo "Hello World" ❸
❶
The rst line begins with the Shebang characters (#!) which is an indicator that
this le is a script. The script is executed with the specied interpreter after the
Shebang, in this case /bin/sh.
❷ The second line is a comment beginning with the hash sign. It is recommended
to comment dicult lines to remember what they do.
❸
The third line uses the built-in command echo to print the corresponding text.
Before you can run this script you need some prerequisites:
1. Every script should contain a Shebang line (this is already the case with our ex-
ample above.) If a script does not have this line, you have to call the interpreter
manually.
2. You can save the script wherever you want. However, it is a good idea to save
it in a directory where the shell can nd it. The search path in a shell is determined
by the environment variable PATH. Usually a normal user does not have write
access to /usr/bin. Therefore it is recommended to save your scripts in the users'
directory ~/bin/. The above example gets the name hello.sh.
228 Start-Up