A shell script to calculate yearly and aggregated monthly depreciation for assets defined in a YAML file.
- Methods: Supports Straight-Line (default) and Declining Balance (Double Declining) methods.
- YAML Data: Loads asset details (value, lifespan, mode, salvage value) from a simple YAML config.
- Aggregate Reporting: Optional monthly schedule that groups identical depreciation periods and calculates annualized impact.
- Date Aware: Starting month can be customized, and report periods are labeled with human-readable dates (e.g.,
Jan 2026 - Dec 2026). - Precision: Uses
bcfor high-precision floating-point arithmetic. - Visuals: Clean, colored, and formatted terminal output.
yq: For parsing YAML files.bc: For floating-point calculations.
-
Define assets in
assets.yaml:assets: - name: "Office Server" value: 8000 lifespan: 4 mode: "Declining Balance" salvage_value: 800 - name: "Office Furniture" value: 1200 lifespan: 10 # mode defaults to Straight-Line salvage_value: 100
-
Run the script:
# Basic yearly report ./depreciate.sh # Yearly report + Aggregated Monthly Schedule ./depreciate.sh -m # Aggregated Monthly Schedule starting from a specific date ./depreciate.sh -m 2026-03 # Use a custom YAML file ./depreciate.sh my_assets.yaml -m
-m: Enables the "Overall Monthly Depreciation Schedule" at the end of the report.YYYY-MM: (Optional) Sets the starting month for the date labels. Defaults to the current month.file.yaml: (Optional) Path to the asset configuration file. Defaults toassets.yaml.
chmod +x depreciate.sh