Creating Classes And Objects Using Bash Scripting
Answer : You can try to do something like this example.sh #!/bin/bash # include class header . obj.h . system.h # create class object obj myobject # use object method myobject.sayHello # use object property myobject.fileName = "file1" system.stdout.printString "value is" system.stdout.printValue myobject.fileName obj.h obj(){ . <(sed "s/obj/$1/g" obj.class) } obj.class # Class named "obj" for bash Object # property obj_properties=() # properties IDs fileName=0 fileSize=1 obj.sayHello(){ echo Hello } obj.property(){ if [ "$2" == "=" ] then obj_properties[$1]=$3 else echo ${obj_properties[$1]} fi } obj.fileName(){ if [ "$1" == "=" ] then obj.property fileName = $2 else obj.property fileName fi } system.h . system.class system.class system.stdout.printValue(){ echo $($@) } system.stdout.printString(){ echo $@ } Link for refer...