Prev | Current Page 340 | Next

Michael McCallister

"openSUSE Linux Unleashed"


After indicating the shell, commands are entered onto each line of the file, followed by a
carriage return. As mentioned, comments can be added by using the pound sign. An
example looks like this:
#!/bin/bash
# This script displays the date and who??™s logged on
date
who
And that is all there is to it. Save this script in a file called test1, and you are almost
ready. The next section describes how to run the new script on the system.
Running Scripts
Once your text shell script is created, you??™ll want to run in on your system. The next step
is to tag the shell script file as an executable file so that it can be run on the Linux system.
In the Windows world, you can tell if a file is executable by its file name extension. It is
common knowledge that files that end in .com or .exe are binary executable files, and
files that end in .bat are text batch files that can be executed.
Linux doesn??™t use filename conventions to identify executable files. You can have script
files called testing, myscript.txt, or even this.is.a.test.script. Instead, Linux uses file properties
to tag whether a file is executable.


Pages:
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352
news news news news news