22 lines
		
	
	
		
			413 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			413 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| [ -f functions.sh ] && source functions.sh
 | |
| 
 | |
| # Dependencies required by this module
 | |
| dependencies=("calc")
 | |
| 
 | |
| # Check dependencies before running
 | |
| if ! check_dependencies "${dependencies[@]}"; then
 | |
|     msg "$2" "$1: This module requires: ${dependencies[*]}"
 | |
|     exit 1
 | |
| fi
 | |
| 
 | |
| calculate() {
 | |
|     calc -- "$*" | tr -d '[:space:]'
 | |
| }
 | |
| 
 | |
| name="$1"
 | |
| shift
 | |
| chan="$1"
 | |
| shift
 | |
| msg "$chan" "$name: $(calculate "$*")"
 |