Skip to content

Commit f411d51

Browse files
committed
docs: wrap install script in main() for curl-pipe-bash
bash reads scripts from stdin line by line. When exec < /dev/tty redirects stdin to the terminal, bash loses the rest of the script. Wrapping in a function forces bash to read the entire script into memory before executing β€” standard pattern for curl | bash scripts.
1 parent 49a06e2 commit f411d51

1 file changed

Lines changed: 58 additions & 52 deletions

File tree

β€Žinstall.shβ€Ž

Lines changed: 58 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,74 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# Redirect stdin to the terminal only when piped (e.g. curl | bash).
5-
# When run directly, keep the inherited fd β€” TUI apps like claude need it untouched.
6-
if [ ! -t 0 ]; then
7-
exec < /dev/tty
8-
fi
4+
# Wrap in a function so bash reads the entire script from stdin before executing.
5+
# Without this, `curl | bash` breaks when we redirect stdin to /dev/tty.
6+
main() {
7+
# Redirect stdin to the terminal only when piped (e.g. curl | bash).
8+
# When run directly, keep the inherited fd β€” TUI apps like claude need it untouched.
9+
if [ ! -t 0 ]; then
10+
exec < /dev/tty
11+
fi
912

10-
echo ""
11-
echo " remobi β€” your terminal, everywhere"
12-
echo " https://github.com/connorads/remobi"
13-
echo ""
14-
echo " This script will:"
15-
echo " 1. Install the remobi setup skill (via npx skills)"
16-
echo " 2. Ask which coding agent you use"
17-
echo " 3. Start an interactive agent session that walks you through setup"
18-
echo ""
19-
read -r -p "Press Enter to continue..."
13+
echo ""
14+
echo " remobi β€” your terminal, everywhere"
15+
echo " https://github.com/connorads/remobi"
16+
echo ""
17+
echo " This script will:"
18+
echo " 1. Install the remobi setup skill (via npx skills)"
19+
echo " 2. Ask which coding agent you use"
20+
echo " 3. Start an interactive agent session that walks you through setup"
21+
echo ""
22+
read -r -p "Press Enter to continue..."
23+
24+
# ── Install the remobi-setup skill ────────────────────────────────────────
25+
26+
echo ""
27+
echo "Installing the remobi setup skill..."
28+
echo ""
29+
npx skills add connorads/remobi
30+
echo ""
2031

21-
# ── Install the remobi-setup skill ──────────────────────────────────────────
32+
# ── Pick a coding agent ───────────────────────────────────────────────────
2233

23-
echo ""
24-
echo "Installing the remobi setup skill..."
25-
echo ""
26-
npx skills add connorads/remobi
27-
echo ""
34+
echo "Which coding agent do you use?"
35+
echo " 1) Claude Code"
36+
echo " 2) Codex"
37+
printf "Choose [1-2]: "
38+
read -r choice
2839

29-
# ── Pick a coding agent ─────────────────────────────────────────────────────
40+
case "$choice" in
41+
1) agent="claude" ;;
42+
2) agent="codex" ;;
43+
*)
44+
echo "Invalid choice. Exiting."
45+
exit 1
46+
;;
47+
esac
3048

31-
echo "Which coding agent do you use?"
32-
echo " 1) Claude Code"
33-
echo " 2) Codex"
34-
printf "Choose [1-2]: "
35-
read -r choice
49+
# ── Check the agent is installed ──────────────────────────────────────────
3650

37-
case "$choice" in
38-
1) agent="claude" ;;
39-
2) agent="codex" ;;
40-
*)
41-
echo "Invalid choice. Exiting."
51+
if ! command -v "$agent" > /dev/null 2>&1; then
52+
echo ""
53+
echo "Error: '$agent' is not installed."
54+
echo ""
55+
case "$agent" in
56+
claude) echo " curl -fsSL https://claude.ai/install.sh | bash" ;;
57+
codex) echo " npm install -g @openai/codex" ;;
58+
esac
59+
echo ""
60+
echo "Install it, then re-run this script."
4261
exit 1
43-
;;
44-
esac
62+
fi
4563

46-
# ── Check the agent is installed ────────────────────────────────────────────
64+
# ── Launch interactive setup session ──────────────────────────────────────
4765

48-
if ! command -v "$agent" > /dev/null 2>&1; then
4966
echo ""
50-
echo "Error: '$agent' is not installed."
67+
echo "Starting $agent with the remobi-setup skill..."
5168
echo ""
52-
case "$agent" in
53-
claude) echo " curl -fsSL https://claude.ai/install.sh | bash" ;;
54-
codex) echo " npm install -g @openai/codex" ;;
55-
esac
56-
echo ""
57-
echo "Install it, then re-run this script."
58-
exit 1
59-
fi
60-
61-
# ── Launch interactive setup session ────────────────────────────────────────
6269

63-
echo ""
64-
echo "Starting $agent with the remobi-setup skill..."
65-
echo ""
70+
# exec replaces this shell with the agent process, giving it full terminal control
71+
exec "$agent" "Use the remobi-setup skill to onboard me."
72+
}
6673

67-
# exec replaces this shell with the agent process, giving it full terminal control
68-
exec "$agent" "Use the remobi-setup skill to onboard me."
74+
main "$@"

0 commit comments

Comments
Β (0)