holzschu / holzschu/a-shell

Heredoc is not delivered to the command reading it — `cat <<EOF` hangs, and `cat > file <<EOF` writes an empty file

Open
#1,054 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Perl
Stars
3.9k
Forks
213
Avg merge
1m
Merged PRs (30d)
1

Description

Thanks for a-Shell — it's the only thing that makes a real POSIX toolchain possible on an iPad, and I've been building offline marine navigation tools around it.

I've hit what looks like a heredoc problem. Two symptoms, and I suspect one cause.

### 1. A heredoc feeding a command hangs

Typed at the a-Shell prompt:

```sh
cat <<'M'
hello
M
```

**Expected:** prints `hello`, returns to the prompt.

**Actual:** nothing prints and the terminal stops responding. `cat` appears to be reading the terminal rather than the heredoc — every Return I press comes back as a blank line. Since the on-screen keyboard has no Ctrl or Esc, the only way out is to open a new window.

### 2. With output redirected, the heredoc writes nothing

```sh
cat > /tmp/out.txt <<'M'
hello
M
```

**Expected:** `out.txt` contains `hello`.

**Actual:** `out.txt` is created and is **0 bytes**. No error, exit status looks normal. This one doesn't hang — `cat` seems to see end-of-input immediately.

That second form is how my tools unpacked their embedded awk engines, so every engine on the iPad was zero bytes. The programs then failed in confusing ways much later, which is why it took a while to find.

### Environment

- a-Shell version: Downloaded from App Store on Aug 30, 2026
- iOS/iPadOS version: 26.5
- Device: iPad mini
- a-Shell or a-Shell mini: a-Shell

### Workaround, for anyone who finds this

- For printing text, `printf '%s\n' 'line one' 'line two'` instead of `cat <

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the a-Shell prompt and reproduce both heredoc commands from the issue, checking whether input reaches cat and whether the redirected file receives content. No source file or test is named; done means both commands complete normally, print or write "hello", and preserve the existing workaround behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.