Skip to content
BENIBIX Learn

Shell Script vs PowerShell

People think PowerShell is just the Windows version of a Bash shell script, and it is not. Both run commands one after another from a file. A Bash command hands the next one plain text, which has to be picked apart. A PowerShell command hands over objects with named parts, such as a file's name and size. PowerShell now runs on macOS and Linux too.

Development🔤 Languages

Shell Script

A file of commands the shell runs in turn, so you type less.

A shell script is a text file full of commands that a shell runs one after another. Anything you can type at the command line can go in it. The first line, called the shebang, names the shell to use, such as Bash. You make the file runnable once, then run it by name. Scripts save time on jobs you do again and again.

Example
Jack writes a three-line script that copies his notes folder into a dated backup. A timer runs it every night.
Why it matters
Most server and build jobs are glued together with shell scripts. They turn a list of steps into one command.
Full entry
Development🔤 Languages

PowerShell

A shell and script language that passes data with named parts, not plain text.

PowerShell is a shell and scripting language for automating computer jobs. Most shells pass plain text from one command to the next. PowerShell passes whole objects, with named parts, so you do not have to cut text up. It runs on Windows, Linux and macOS. It is widely used to manage Windows machines and cloud services.

Example
Microsoft makes PowerShell. An admin uses one line of it to list the three programs using the most CPU. Each result has named parts, like Name and CPU.
Why it matters
Most Windows and Azure admin work is done in it. Objects make long chains of commands safer.
Full entry

In one line

Shell Script
A file of commands the shell runs in turn, so you type less.
PowerShell
A shell and script language that passes data with named parts, not plain text.