Batch/Shell Scripting

<still under construction>

< to add contents from here: https://superuser.com/questions/120045/how-to-execute-sh-file-on-windows>

Batch for Windows; Shell for Unix-based OS.

A parameter is an entity that stores values.
A variable is a parameter denoted by a name.
Parameter expansion is the procedure to get the value from the name.

Paging divides large amount of displayed text to pages using a set PAGER software, e.g. for 100 lines of code, it displays 10 lines and every next 10 lines by the end user’s keypress, another example are HTML pages

POSIX (Portable Operating System Interface) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between OSs. For example, a byte is 8 bits

Exclusive examples can be found in the Batch & Shell repositories

Shell Types

TypeWhat it Is
bashBourne Again Shell
(default Linux & Mac shell)
shBourne Shell
cshC Shell
#!/bin/bash

The #! sets the shell type to use.

Comment

BatchShell
:: comment# comment

Shell in Windows

Command Prompt

Windows settings (Win key + i) > search Windows Features > Enable (and install) Windows Subsystem for Linux

To install distro,

Pick one from list

wsl --list --online

Install

wsl -d --install <distroname>

In cmd: Bash <*.sh filename>

WSL

Run PowerShell as administrator

wsl --install

Windows files are located in the mnt folder that’s located in the / root.

The Ubuntu’s root is located here in Windows:

C:\Users\<username>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc

To run *.sh files, use: sh <filename>

As wsl is installed as an app, access it as how you access apps.

--- :: Skyferia Tech's Related Posts :: ---