47fac22230
- .claude/CLAUDE.md - .claude/commands/subagentes.md - .claude/rules/INDEX.md - .mcp.json - bash/functions/cybersecurity/analyze_dns.md - bash/functions/cybersecurity/audit_http_headers.md - bash/functions/cybersecurity/audit_ssh_config.md - bash/functions/cybersecurity/check_firewall.md - bash/functions/cybersecurity/detect_suspicious_users.md - bash/functions/cybersecurity/encrypt_file.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.5 KiB
Markdown
44 lines
1.5 KiB
Markdown
---
|
|
name: android_shell
|
|
kind: function
|
|
lang: bash
|
|
domain: infra
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "android_shell([--serial <S>], cmd ...args)"
|
|
description: "Execute arbitrary shell command on Android device. Multi-emulator via --serial."
|
|
tags: [android, adb, shell, exec, pendiente-usar]
|
|
params:
|
|
- name: "--serial <S>"
|
|
desc: "Optional target device serial. Omit to auto-pick (single device) or use ADB_SERIAL env."
|
|
- name: "cmd ...args"
|
|
desc: "Shell command + args to run on device. Variadic."
|
|
output: "Passthrough stdout/stderr de adb shell. Exit code = shell command exit."
|
|
uses_functions: ["adb_wsl_bash_infra"]
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: []
|
|
tested: false
|
|
tests: []
|
|
test_file_path: ""
|
|
file_path: "bash/functions/infra/android_shell.sh"
|
|
notes: "Para comandos complejos con pipes/redirects mejor `adb_s $serial shell 'cmd | other'` directo via adb_run."
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```bash
|
|
android_shell pm list packages
|
|
android_shell --serial emulator-5554 getprop ro.product.model
|
|
android_shell df -h /sdcard
|
|
android_shell ls -la /data/local/tmp
|
|
```
|
|
|
|
## Notas
|
|
|
|
Sourcea `adb_wsl.sh` para resolver `adb_pick_serial` (maneja `--serial`, `ADB_SERIAL`, y auto-detect de dispositivo unico) y `adb_s` (wrapper de `adb -s`). El array `ADB_PICK_REST` contiene los args restantes tras consumir `--serial`.
|
|
|
|
Para comandos con pipes o redirects que bash interpretaria localmente, mejor pasar como string unico: `adb_s "$serial" shell 'cmd | grep foo'`.
|