mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-02-24 21:47:26 +00:00
add heredoc rule
This commit is contained in:
18
docs/AI.md
18
docs/AI.md
@@ -477,6 +477,24 @@ $STD sudo -u postgres psql -d mydb -c "CREATE EXTENSION IF NOT EXISTS postgis;"
|
||||
PG_DB_NAME="mydb" PG_DB_USER="myuser" PG_DB_EXTENSIONS="postgis" setup_postgresql_db
|
||||
```
|
||||
|
||||
### 17. Writing Files Without Heredocs
|
||||
```bash
|
||||
# ❌ WRONG - echo / printf / tee
|
||||
echo "# Config" > /opt/app/config.yml
|
||||
echo "port: 3000" >> /opt/app/config.yml
|
||||
|
||||
printf "# Config\nport: 3000\n" > /opt/app/config.yml
|
||||
cat config.yml | tee /opt/app/config.yml
|
||||
```
|
||||
|
||||
```bash
|
||||
# ✅ CORRECT - always use a single heredoc
|
||||
cat <<EOF >/opt/app/config.yml
|
||||
# Config
|
||||
port: 3000
|
||||
EOF
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📝 Important Rules
|
||||
|
||||
Reference in New Issue
Block a user