Chapter 1
In This Chapter
Before we get our hands on the keyboard, let's spend a few pages getting to know cshw — what it is, where it came from, and why someone (Tarie, the person who built it) thought the world needed yet another shell. If you're itching to start typing, you can skip ahead to Chapter 2 and come back here later. We won't be offended.
A shell is a program whose entire job is to take what you type, figure out what you meant, and run it. It's the layer between you and the operating system. When you double-click a file in Explorer, that's a shell. When you open Command Prompt and type dir, that's a shell. When you're using PowerShell, Bash, zsh, fish, csh, tcsh, or — yes — cshw, you're using a shell.
Graphical shells like Explorer are great for browsing and casual file management. Command-line shells are great for everything else: running tools, automating repetitive tasks, processing files in bulk, talking to remote machines, building software, and — broadly — making the computer do what you want without dragging things around with a mouse.
REMEMBER
A shell is, at its core, a really good text-based UI for your operating system. The "command line" is the place you type, and the shell is the program that listens.
In the 1970s, Bill Joy at Berkeley built a shell called csh — short for "C Shell," because its scripting language was meant to feel a bit like C. csh introduced ideas like command history, aliases, and job control that every modern shell still uses today. tcsh added editable command lines (let's say a quiet thank-you for that one) and stuck around as a default on a lot of BSD systems.
cshw is a love letter to that lineage, written for Windows. It borrows the parts of csh and tcsh that are still good — the friendly syntax, the if/then/endif structure, foreach, the @ arithmetic command, the way history just works — and pairs them with the things modern shells deserve: real concurrency, integrated AI, a clean plugin model, and a scripting language built on a proper parser instead of a chain of regular expressions held together with hope.
TECHNICAL STUFF
Under the hood, cshw is a native Win32 application written in C++. Its scripting layer uses a recursive-descent parser to build an abstract syntax tree, which is then walked by an interpreter. That's a fancy way of saying it doesn't blow up when your script has a comma in the wrong place.
Windows ships with two command-line tools out of the box: cmd.exe (historical, lightly cursed, still useful for batch files) and PowerShell (powerful, verbose, has its own opinions about how the world should be). Both are fine. Both have rough edges.
cshw exists for the people who want a third option that:
If you live in PowerShell and love it, this book isn't going to convert you, and that's fine — they're different tools for different moods. But if PowerShell's ceremony grates on you, or if you miss the snappy pipe-everything-into-everything feeling of a Unix shell, you're in the right place.
Here's the rough inventory of what you can expect to find in cshw, in approximately the order the book covers it:
ls, cp, mv, rm, grep, sed, awk, find, cat, tail, head, sort, uniq, wc, chmod (best-effort on Windows), and friends. They behave the way you remember from Linux or macOS, with sensible Windows behavior layered in (paths with backslashes work, paths with forward slashes work, paths with spaces work)..cshw can contain procedures, loops, conditionals, arrays, hashes, and library imports. There's an actual parser. Scripts can be run directly or sourced into an existing shell.&, list jobs with jobs, foreground them with fg, kill them with kill. The full classic toolkit.corunproc, wait on them with cowait, coordinate them with mutexes, events, semaphores, barriers, and channels. This is far beyond what a typical shell offers — it's closer to what a real programming language gives you.genai command lets you register one or more LLM providers (Anthropic Claude, OpenAI, Azure OpenAI, Ollama for local models, LM Studio, or any custom OpenAI-compatible endpoint) and call them from the shell. Streaming responses, file analysis, code generation, all built in. You can pipe a log into genai ask and have Claude tell you what broke.rcl, and your new command shows up in the shell.fetch (HTTP), ftpfetch, raw socket commands, tcpserver, tcpclient. Quick network scripting without leaving the shell.man <command> to read the manual page. Type man -k <keyword> to search descriptions.TIP
If a feature on that list sounds like overkill for what you do, that's fine — you don't pay for what you don't use. cshw is happy to be your day-to-day cd-and-grep shell forever, and the heavy machinery is there only if you need it.
Just so we're clear about the boundaries of the territory:
With those expectations set, let's talk about what life in cshw feels like.
To make this concrete, here's a sketch of a fairly normal cshw session. You don't need to type any of this yet — we'll get there in the next chapter. This is just a flavor.
You open the shell. You see a prompt that looks something like this:
Tue 11-04-2025 C:\Users\Tarie\>
That's telling you the day, the date, the current directory, and giving you a > to type after. (Yes, it's configurable. Chapter 7.)
You list a directory:
ls -l Projects
You change into a project folder and check what's changed:
cd Projects\cshw
git status
Yes, that runs the real git.exe. cshw runs external programs the same way any shell does — it finds them on the PATH and launches them. The built-in commands and external programs live side by side.
You realize you've got a stack of log files to scan for errors. Instead of opening each one, you ask Claude:
cat logs\app-*.log | genai ask "summarize the errors and group by type"
The response streams back into your terminal. The full text is saved in $genai_result, in case you want to pipe it somewhere else.
You decide to start three downloads in parallel and wait for them all:
corunproc fetch "https://example.com/a.zip" -o a.zip
corunproc fetch "https://example.com/b.zip" -o b.zip
corunproc fetch "https://example.com/c.zip" -o c.zip
cowait /all
echo All three done.
Three coroutines, three concurrent downloads, one wait. No external tools, no Python script, no fooling around.
That's a normal afternoon. By the end of this book, none of those lines will look mysterious. You'll write your own.
Speaking of which, here's the shape of the journey:
.cshw file" through procedures and libraries.Probably. The only way to find out is to install the thing and start typing. That's Chapter 2.