You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1.1 KiB


This idea was inspired from in order to be adapted into making a proper OOP with constructors, properties and namespace system for bash.


  • .shn: SHell Namespace
  • .shc: SHell Class

Example syntax:

Declaring objects. This is the main script which will use our objects.

. $OOP_ROOT/ # Import library.

importNamespace Example.shn

Example.Object t "Test"

Example.shn: This file declares our namespace and all the objects within it.

# Namespace declaration.
namespace Example
# If namespace is set to null (no argument), then the object will be declared globally.
# Otherwise, the object will be declared within the namespace.

# Object declaration, from class name to file name.
class Object "Object.shc"

Object.shc: This file will contain the object code.

# Property declaration

# Optional constructor.
Object.constructor() { = $1

# Example function
Object.print() {
    echo "Example OOP from $($!"