Advertisement
SyP-

bash_oop.sh

Aug 28th, 2023
1,307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.36 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # Object maker
  4.  
  5. class_Chair() {
  6.  
  7.   self=$1
  8.  
  9.   attributes="$@"
  10.  
  11.   read -ra ${1} <<< "$attributes"
  12.  
  13.   export ${1}
  14. }
  15.  
  16. # Methods
  17.  
  18. chairAttr() {
  19.  
  20.   var="$1[@]"
  21.   echo ${!var}
  22.  
  23. }
  24.  
  25.  
  26. # Create object class_Chair objectName model color type
  27.  
  28. class_Chair novaNevara nv-123 red outdoor
  29.  
  30. output=$(chairAttr novaNevara)
  31.  
  32. echo $output
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement