Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Ensure .bashrc exists (#10461)

Engel Nyst822ce8615035
diff --git a/openhands/runtime/base.py b/openhands/runtime/base.py
index e1cf4c9560..d758c9802b 100644
--- a/openhands/runtime/base.py
+++ b/openhands/runtime/base.py
@@ -280,7 +280,7 @@ class Runtime(FileEditRuntimeMixin):
# Note: json.dumps gives us nice escaping for free
cmd += f'export {key}={json.dumps(value)}; '
# Add to .bashrc if not already present
- bashrc_cmd += f'grep -q "^export {key}=" ~/.bashrc || echo "export {key}={json.dumps(value)}" >> ~/.bashrc; '
+ bashrc_cmd += f'touch ~/.bashrc; grep -q "^export {key}=" ~/.bashrc || echo "export {key}={json.dumps(value)}" >> ~/.bashrc; '
if not cmd:
return