PRODUCT






Home









Free Download








Installation Instructions





FAQ





FAQ








Ask A Question





LEARN SCRIPTING





Overview








Lesson 1








2


3


4


5








Exam





SAMPLE SCRIPTS





Computer








Internet








Administrators








Developers








Data








Miscellaneous





HELP / DOCUMENTATION





Commands








Automated Internet








Automated Editors








Sample Scripts








Precompiled Functions








System Features






Learning Scripting - Lesson 1
(User Interface, Introduction to Commands, Help Pages, Introduction to Scripting)

In this lesson, we will learn about biterScripting user interface. We will learn about some basic commands. We will also take a look at how to effectively use the help pages. We will introduce ourselves to the concept of a script. A brief discussion on how to start and stop biterScripting, will conclude this lesson.



PREPARATION
  1. You will need biterScripting on your computer for all the lessons. Download biterScripting free by following instructions here . If you have an older version of biterScripting, redownload it.


  2. Do you see a biterScripting icon on your desktop ? If not, please reboot your computer. Now, you should see the biterScripting icon on your desktop.


  3. Double click the biterScripting icon on your desktop. It will start biterScripting. Enter the following command in the area below the word 'Ready'. Enter the command exactly as you see it below. (You can copy and paste the command.) Then press the ENTER key.

    Command
    script "http://www.biterscripting.com/LearningScripting/Prep1.txt"


    Keep biterScripting open throughout this lesson. Make C:/LearningScripting/Lesson1 the current directory, by entering the following command. (This directory was created by the above script command.)

    Command
    ccd "C:/LearningScripting/Lesson1"








1.1. USER INTERFACE

As you saw above, when you start biterScripting, it has the following user interface.

Figure 1.1 - biterScripting User Interface
Figure 1.1 - biterScripting User Interface


Input Area is where you type in commands. This area accepts one line of input at a time. You can do copy and paste from/into this area. After typing a command in this area (or after doing copy-and-paste), hit the ENTER key to send the command for processing.

Output Area is where you see the output and errors from executed commands. This is a read-only area. You can copy from this area. But, you can not paste into this area.

Status Area is where you see status messages. This is also a read-only area. You will also see error messages from commands that encounter incorrect syntax. Some of the common status messages you see are -

ReadybiterScripting is ready to accept and execute next command.
Executing ...biterScripting is executing previous commands.
Waiting for do to complete ...A do command was previously entered, and biterScripting is waiting for the corresponding done command. (We have not looked at programming concepts such as do, done, if, else, while, etc. yet. So, this will make sense only after we discuss them in the next couple of lessons.)


QUESTION 1.1 When you see 'Ready' in the status area, what does it mean ? Answer



1.2. SIMPLE COMMANDS

The primary task of biterScripting is to execute commands. We will now study some simple commands. Go ahead and enter the following command in the input area. (Throughout these lessons, when I say 'Enter the following command', you can simply copy each line of command from the the lesson, paste it into biterScripting input area, then press the ENTER key. You can copy-and-paste only one command line at a time - the input area accepts only one line at a time.)

Command
scd


What do you see in the output area ? You will see a directory. This is called the current directory. At any time, biterScripting is working at one directory in your computer, called the current directory. The scd command (short for 'show current directory') shows that directory.

You may have noticed that the current directory starts with a C:/ (or another drive letter), and it contains the full path of the current directory. Files and directories in a computer can be specified either with a full path or a relative path. The full path starts with a slash (/) or with a drive letter, followed by a colon (:), followed by a slash (/). For example, C:/LearningScripting, C:/, /, /LearningScripting are all full paths. Full path is also known as absolute path.

The relative path starts without a forward slash, or without a drive letter. A relative path is always relative to the current directory. For example, LearningScripting, LearningScripting/Lesson1/Test1.txt are relative paths.

Some operating systems use a backslash instead of a forward slash when specifying paths. biterScripting will accept either the forward slash or the back slash when you are specifying a path.

I will now introduce the next command. It is the ccd command. It is short for 'change current directory'. To use this command, you type in the word ccd followed by a directory. Type in the following in the input area.

Command
ccd "C:/LearningScripting/Lesson1"


The above command will change the current directory to C:/LearningScripting/Lesson1. (We will work in this directory throughout this lesson.) To verify that the current directory is indeed C:/LearningScripting/Lesson1, type the scd command again.

Command
scd


The output of the scd command above should show C:/LearningScripting/Lesson1.

The double quoted string "C:/LearningScripting/Lesson1" in the ccd command is called the command argument. A command argument is an object on which the command operates - it can be a file, directory, a string constant (double quoted string), a number, etc. Commands take various number of arguments. The scd command takes no arguments. The ccd command takes one argument. In further lessons, we will look at commands that take multiple arguments, and commands that take a variable number of arguments. For now, it is important to understand only the concept of command argument.

When specifying a directory, a couple of special notations may be used. The dot (.) means the current directory. And, the dot-dot (..) means the parent directory (the parent directory of the current directory).

The next basic command is the repro command. The repro command (short for reproduce), reproduces the contents of a file on screen. Type the following command in the input area.

Command

repro "C:/LearningScripting/Lesson1/Test1.txt"


You should see two lines of text. (We created this Test1.txt file in the Prep1.txt script that we ran before starting this lesson.) So, the repro command reads in a file, and outputs its contents to the output area.

The command argument (file name) to the repro command can be specified using either the full path or the relative path. Let's try the repro command in both ways. Type the following commands. (Type one command at a time. Hit the ENTER key after each command.)

Commands

repro "C:/LearningScripting/Lesson1/Test1.txt"
repro "Test1.txt"


We used full path in the first repro command. We used relative path in the second repro command. Both reproduced the contents of the file Test1.txt.

QUESTION 1.2 Change the current directory to the directory at the hard drive level. Change the current directory back to "C:/LearningScripting/Lesson1". Answer



1.3. HELP

The entire documentation for biterScripting was downloaded to your computer when you downloaded and installed biterScripting. The documentation is contained in the help pages. This documentation is available with the use of the help command. Help is available in various categories - commands, functions, system features, sample scripts, etc. Let's us look at the help pages for the commands we just learned. Type in the following commands one by one and look at their output.

Commands
help scd
help ccd
help repro


You should read the help pages for each of those commands. Help is also available on the help command itself.

QUESTION 1.3 Type the following command. Read the output. What command should one use to search help topics for the keywords - performance aspects ?

Command
help help
Answer

Please keep in the habit of often looking up help on various topics.

The following notation is used in help pages.

<item>When an item is enclosed in angular brackets, substitute it with an appropriate object (file name, path, constant, expression, etc.). When an item is not enclosed in angular brackets, enter that item exactly as it shown.
[item]When an items is enclosed in square brackets, it is optional. When an item is not enclosed in square brackets, it is required.
[item1 [item2 [item3] ] ]When square brackets are nested, the items, if specified, can only be specified in order from left to right. item1 is optional. item2 is also optional, but can be specified only if item1 is specified. item3 is also optional, but can be specified only if item1 and item2 are specified.
...Three dots mean etc.
item1 | item2 When two or more items are separated by vertical bar, use only one of them.
"item"When an item is enclosed in double quotes, it needs to be enclosed in double quotes. (Double quotes indicate that the item is a string (str) constant.)
(item)When an item is enclosed in parentheses, it needs to be enclosed in parentheses. (Parentheses indicate that the item is an expression, and needs to be evaluated.)






1.4. INTRODUCTION TO A SCRIPT

We will now introduce the concept of a script. A script is a collection of commands. This collection of commands is stored in a file. Typically, bierScripting users write scripts and use them over and over.

You don't know enough commands yet, so I wrote a script for you. This script first lists all files and directories within C:/LearningScripting by name. It then lists them with all their attributes. Finally it counts the number of files and directories in C:/LearningScripting.

The script is stored at "C:/LearningScripting/Lesson1/Script1.1.txt" . Go ahead and execute it using the following command. Read the output. (This script pauses from time to time, so that you can slowly read the output.)

Command
script -l "C:/LearningScripting/Lesson1/script1.1.txt"


Now, open file C:/LearningScripting/Lesson1/Script1.1.txt with any text editor and take a look. You may not understand all of it yet - and that's ok. In the next couple of lessons, you will learn how to develop scripts on your own. I only wanted to introduce you to the concept of a script here.



1.5. STARTING AND STOPPING BITERSCRIPTING

We know that to start biterScripting, we double click on its icon on the desktop.

To stop biterScripting, simply click on the X in the top right corner of the user interface. That will shut down biterScripting.

When you attempt to shut down biterScripting, if any commands are still runnning, it will ask you 'Prior commands are still executing. Do you wish to abort the execution ?' or a similar question. Click 'Yes' to abort all prior commands. When the word 'Ready' appears in the status area, click the X in the top right corner of the user interface again to shut down biterScripting. I will demonstrate. Enter the following command in the input area.

Command
script "C:/LearningScripting/Lesson1/InfiniteLoop.txt"


The above command will take biterScripting into an infinite loop. That means, the command will never terminate. (If you don't understand the above command, that's ok. We are merely using that command to demonstrate how to shut down biterScripting even when commands are running.) The word 'Executing' appears in the status area. Try to shut down biterScripting by clicking on the X in the top right corner. You will see the message inquiring whether you want to abort execution. Click 'Yes'. The word 'Ready' will appear in the status area. Now, you can shut down biterScripting by clicking on the X in the top right corner again.

Needless to say, you should consider consequences before aborting already executing commands. In this demonstration, it is perfectly safe to abort, since the above command does nothing but sleeping.



DID YOU KNOW ?
  1. For people who have already programmed in other scripting languages, biterScripting provides aliases to each command. This makes it easy for them to identify biterScripting commands that may be similar to commands in other scripting languages. For example, the scd command has alias 'pwd'. The ccd command has alias 'cd'. And, the repro command has alias 'cat'.

    The help page for each command lists these aliases. You can use these aliases instead of the biterScripting command names, if you so choose. Also, the help pages are also accessible by the aliases. For example if you type 'help cat', it will show the help page for the repro command.

  2. biterScripting does not make a distinction between local files and files on the internet. For example, the repro command will show you the contents of a file on the internet, just the same, as it would show you the contents of a file on your computer. Type the following command.

    Command
    repro "http://www.biterscripting.com/LearningScripting/Lesson1.html"


    The above will show you the content of this very page (Lesson1.html) you are reading. I will show you later how to effectively use this convenience.




SUMMARY

In this lesson, we learned
  1. How to start biterscripting and how its user interface looks.
  2. Some basic commands - scd, ccd, repro .
  3. How to access documentation using the help command.
  4. The basics of a script.




HOMEWORK 1
  1. Revisit the important concepts we learned in this lesson. (Look at this page from top to bottom. The important concepts are the words, phrases or sentences in red color.) Did you understand them ? Answer
  2. Using the help command, find the command that finds files based on a file name pattern. Read the help page for that command. Answer





2008-2014, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterMobile, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com. Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.