Free SH test files and sample generator

Executable Unix shell script (Bash/POSIX). Used for automation, setup and CI tasks on macOS and Linux.

Generate a .sh file →

What is a .sh file?

SH: Shell Script. A shell script is executable text run by bash or sh. Because running one executes arbitrary commands, upload and execution paths around shell scripts deserve careful testing.

Why generate a test SH file?

What you can put inside a .sh file

You get 3 content options for SH, so the file holds something meaningful rather than random padding: Basic script, Variables + loop, Commands + comments. For SH these are alternatives, so choose the one that matches what you need to test.

How a .sh file is identified

A .sh file has no signature at the start. A script is identified by its extension and, on Unix, by a #! on the first line, which is why a byte-order mark breaks it.

How the size lands on the exact byte

The format allows comments, so the padding is comment lines, legal, inert, and visible if you open the file.

Negative testing with broken SH files

Which failure to reach for, and what to assert for each, is covered in how to make a corrupted file for testing. For upload limits and type checks see testing file upload validation, and for this format's encodings, UTF-16 and BOM test files.

Sample SH content

#!/bin/bash
set -e
echo "Seeding test data..."
./seed --env=test

This shows the shape of the file. Your download is generated fresh at the size you choose, so the values will differ.

How to open and verify the file

Check syntax without running it: `bash -n file.sh`, or lint with `shellcheck`.

Media type application/x-sh · extension .sh · category Scripts & OS

Generate a .sh file → · questions about sizes, privacy or cost are answered on the site FAQ.

Frequently asked questions about SH files

What identifies a .sh file?

Nothing at the start of the file does. A script is identified by its extension and, on Unix, by a #! on the first line, which is why a byte-order mark breaks it.

How can a .sh file be an exact number of bytes?

The format allows comments, so the padding is comment lines, legal, inert, and visible if you open the file.

What can go inside the SH file?

There are 3 content options for .sh: Basic script, Variables + loop, Commands + comments. For SH these are alternatives, so pick the one matching what you need to test.

Can I download several broken SH files at once?

Yes, select more than one File Condition and you get one ZIP containing a .sh per condition, each named after its condition.

Can the SH file use UTF-16 or a byte-order mark?

Yes. .sh is a text format, so it can be generated as UTF-8, UTF-8 with a byte-order mark, UTF-16 LE or UTF-16 BE. The body is shortened before re-encoding so the finished file still lands on the exact size you asked for. Note that a UTF-16 file always has an even byte count.

How do I open or verify the SH file?

Check syntax without running it: bash -n file.sh, or lint with shellcheck.

Related Scripts & OS formats

BAT · PS1 · VBS · DEB · RPM · PKG · APK · AAB

Browse all file formats →