first topic
  
back to Rev 1 index
Topic 15
Techniques and syntax of a scripting language used in the IT industry
Bash:
Bash is a command line shell and scripting language developed in 1989 as part of the GNU Project.
Bash was developed as an enhanced version of the original Bourne Shell.
Bash files are saved with the ‘.sh’ extension.
Bash has the following techniques:
- Command history
- Tab expansion
- One dimensional arrays
- Restricted mode
- Arithmetic calculations
- Shell Customisation
- Directory manipulation
- Command Aliases
Bash has the following syntax:
- ‘#’ symbol is used for commenting the code
- The ‘chmod’ command is used to set the execution permission for bash files
- The ‘chown’ command is used to set the ownership for bash files
- The ‘read’ command is used for getting input from the user
- With variables:
- Variables are not restricted by datatypes. Any type of value can be assigned to variables
- Must use the ‘$’ in front of the variable name when accessing and displaying it.
- The name of the variable can only have letters, numbers and an underscore character.
- The name of the variable can’t start with a number
- The name of the variable can’t contain any spaces
- The name of the variable can’t contain special characters except for the underscore
- There must be no space between the ‘=’ sign when assigning a value to the variable
- With IF statements:
- Square brackets ‘[ ]’ are used for checking the condition
- There must be a space between the square brackets ‘[ ]’
- The ‘then’ keyword is used to begin the IF statement
- The ‘fi’ keyword is used to end the IF statement
- With WHILE loop:
- Square brackets ‘[ ]’ are used for checking the condition
- There must be a space between the square brackets ‘[ ]’
- The ‘then’ keyword is used to begin the WHILE loop
- The ‘fi’ keyword is used to end the WHILE loop
- With FOR loop:
- Square brackets ‘[ ]’ are used for checking the condition
- There must be a space between the square brackets ‘[ ]’
- The ‘do’ keyword is used to begin the FOR loop
- The ‘done’ keyword is used to end the FOR loop
Windows PowerShell:
Windows PowerShell is a command line shell and scripting language developed by Microsoft in 2006.
Windows PowerShell files are saved with the ‘.ps1’ extension.
Windows PowerShell has the following techniques:
- Desired State Configuration
- Error-Handling
- PowerShell Remoting
- Script Debugging
- Tab Expansion
- Network File Transfer
- Constrained Runspaces
- External modules for additional coding functionality
Windows PowerShell has the following syntax: