> ## Documentation Index
> Fetch the complete documentation index at: https://radiusbrowser.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Open tabs conditionally

> Make one startup script adapt to the project and environment.

Shell conditions let a startup script choose which tabs to create without a
separate configuration language.

## Open optional URLs

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
if [ -n "${ISSUE_URL:-}" ]; then
  radius tab open "$ISSUE_URL"
fi

if [ -n "${PULL_REQUEST_URL:-}" ]; then
  radius tab open "$PULL_REQUEST_URL"
fi

if [ -n "${DOCS_URL:-}" ]; then
  radius tab open "$DOCS_URL"
fi
```

## Use a default local server

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
dev_url="${DEV_URL:-http://localhost:3000}"
server="$(radius tab open "$dev_url" --right-of "$RADIUS_TAB_ID")"
```

## Change behavior by branch

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
branch="${GIT_BRANCH:-}"

if [ "$branch" = "main" ]; then
  radius tab open "https://github.com/electron/electron/actions"
fi

if [ -n "${PREVIEW_URL:-}" ]; then
  radius tab open "$PREVIEW_URL" --right-of "$RADIUS_TAB_ID"
fi
```

Radius does not require Git to be installed for this recipe. Supply
`GIT_BRANCH` and `PREVIEW_URL` from whichever tool launches the script.

## Open every URL passed to a script

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
#!/usr/bin/env bash
set -euo pipefail

for url in "$@"; do
  radius tab open "$url"
done
```

Run it with:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
./open-tabs.sh "https://linear.app" "https://github.com" "http://localhost:3000"
```

## Skip an unavailable optional value

Test for values before calling the CLI. Passing an empty URL is an error:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
if [ -n "${DASHBOARD_URL:-}" ]; then
  dashboard="$(radius tab open "$DASHBOARD_URL")"
  radius tab focus "$dashboard"
fi
```
