# A Function Without local Overwrote My Variable and rm -rf Deleted the Wrong Directory

📰 Medium · DevOps

Learn how a function without local variables can overwrite external variables and how to avoid rm -rf disasters in deploy scripts

intermediate Published 22 Jun 2026
Action Steps
  1. Write deploy scripts with caution and test them thoroughly before running in production
  2. Use local variables in functions to avoid overwriting external variables
  3. Configure scripts to handle errors and exceptions properly
  4. Test rm -rf commands in a safe environment before running them in production
  5. Implement backup and restore mechanisms to recover from potential data loss
Who Needs to Know This

DevOps engineers and developers can benefit from this article to improve their scripting skills and avoid common pitfalls

Key Insight

💡 Using local variables in functions and testing scripts thoroughly can prevent common pitfalls in deploy scripts

Share This
💡 Be careful with deploy scripts! A function without local variables can overwrite external variables and rm -rf can delete the wrong directory #DevOps #deploymentscripts

Key Takeaways

Learn how a function without local variables can overwrite external variables and how to avoid rm -rf disasters in deploy scripts

Full Article

The deploy script had been running in production for four months without a problem. It built releases into a temp directory, ran some… Continue reading on Medium »
Read full article → ← Back to Reads

Related Videos

AWS, Azure, GCP: The One Thing Every Business Gets Wrong
AWS, Azure, GCP: The One Thing Every Business Gets Wrong
AI Daily
Containers on Amazon ECS with Mama J
Containers on Amazon ECS with Mama J
AWS Developers
How to Open QTR Files (QuickTime Movie)
How to Open QTR Files (QuickTime Movie)
File Extension Geeks
Improving DevOps Security and Efficiency at Cathay with AWS ProServe | Amazon Web Services
Improving DevOps Security and Efficiency at Cathay with AWS ProServe | Amazon Web Services
Amazon Web Services
Kubernetes Observability 101: Metrics, Logs, Dashboards, and Traces
Kubernetes Observability 101: Metrics, Logs, Dashboards, and Traces
Kubesimplify
Do Azure and AWS Have Too Much Power? The EU’s Answer: Maybe So. #cloud #aws #azure
Do Azure and AWS Have Too Much Power? The EU’s Answer: Maybe So. #cloud #aws #azure
Digital Transformation with Eric Kimberling