Skip to main content

Convenience functions for constructing shell commands.

Latest release 20260912.1: Fix project specification.

Functions for safely constructing shell command lines from bare strings. Somewhat like the inverse of the shlex stdlib module.

As of Python 3.3 the function shlex.quote() does what quotestr() does.

As of Python 3.8 the function shlex.join() does what quoteargv() does.

Short summary:

  • main_shqstr: shqstr: emit shell-quoted form of the command line arguments.

  • quote: Quote the supplied strings, return a list of the quoted strings.

  • quoteargv: Quote strings, assemble into command string.

  • quotestr: Quote a string for use on a shell command line.

Functions

main_shqstr(argv=None)

shqstr: emit shell-quoted form of the command line arguments.

quote(args)

Quote the supplied strings, return a list of the quoted strings.

As of Python 3.8 the function shlex.join() probably does what you would have done with the result of this function i.e. join the resulting strings together.

quoteargv(argv)

Quote strings, assemble into command string.

quotestr(s)

Quote a string for use on a shell command line.

As of Python 3.3 the function shlex.quote() is available for this.

Release Log

Release 20260912.1: Fix project specification.

Release 20260912: Rename quotecmd to quoteargv.

Release 20210316: Minor doc update.

Release 20180613: Rework quotestr significantly to provide somewhat friendlier quoting, include "," in the SAFECHARS.

Release 20170903.2: bugfix main boilerplate after setuptools workaround

Release 20170903.1: workaround setuptool's slightly dumb console_scripts call of a "main" function

Release 20170903: shqstr command; new quotecmd(argv) function

Release 20150118: Extend SAFECHARS to include colon.

Release 20150111: minor cleanup

Release 20150107: initial standalone public release

Release files for cs-sh 20260912.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cs-sh 20260912.1
File Size Uploaded
cs_sh-20260912.1.tar.gz 2.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cs-sh 20260912.1
File Interpreter ABI Platform
cs_sh-20260912.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 6.2 kB

Release files / cs_sh-20260912.1.tar.gz

Download URL cs_sh-20260912.1.tar.gz
Size 2.7 kB
Tags Source
SHA-256 checksum
How to use checksums
14d2b31959292fbed54781790391b7b8a5da83a3bf569315cfff3ac425ed96ea
BLAKE2b-256 checksum
How to use checksums
f79537c8d65f0379ac0646a12f646ecd9b813dd74e528d4cf5e830141182cd01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / cs_sh-20260912.1-py2.py3-none-any.whl

Download URL cs_sh-20260912.1-py2.py3-none-any.whl
Size 3.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
0fde522f1817c5ed5fb67a0aa5625e3c1b740c438a9e2c2bb7c3210d394c83c7
BLAKE2b-256 checksum
How to use checksums
dfb4a433cd89c5ff10eb5b55cdaaf86821211ebbb2259dae8cb597432de0082d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

20260912.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page