Skip to main content

Write your shell scripts using Python

Project description

Write and test your shell scripts using Python

Shell scripts are great - they run on most *nix machines, they allow you interact with the file system easily, and they are light weight and don't require a massive runtime. However, the syntax is error prone and they are difficult to manage and test. Shellshock lets you write and test your shell scripts using the Python syntax and test cases you already know and love.


Writing with Shellshock requires Python. The shell scripts it outputs do not require Python to run though.

pip install shellshock


To convert a Python shellshock script to a regular shell script:

shellshock -o

Starting with an existing shell script

Let's say you have an existing shell script you want to convert that looks like this:

if [ -f "file" ]; then
  echo "ok"

You can easily make this a shellshock script using the method and a multiline string at the top of the file:

import shellshock as ss"""
if [ -f "file" ]; then
  echo "ok"

Then you could convert it to full Python shellscript syntax like so:

import shellshock as ss
if ss.isfile("file"):

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for shellshock, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size shellshock-0.0.1.tar.gz (11.4 kB) File type Source Python version None Upload date Hashes View
Filename, size shellshock-0.0.1-py3-none-any.whl (41.5 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page