binpash / binpash/hs

Unexpected Filename Expansion in AWK Command Affects * Operator Usage

Open
#63 0 comments 0 reactions 0 assignees View on GitHub
bug parsing
Dominant language
Shell
Stars
19
Forks
0
PR merge metrics
No merged PRs in 30d

Description

When I run the following `awk` command:

```bash
awk -v NCHARS=$nchars 'BEGIN {
OFMT = "%.2g%%"}
{print $1, $2, $1 / NCHARS * 100}' "res1"
```

The `*` character seems to get expanded, even though it's part of the `awk` code. Instead of treating the `*` as a multiplication operator, it expands to the list of filenames in the directory as follows:

```bash
awk -v NCHARS="4862992" 'BEGIN { OFMT = "%.2g%%"} {print $1, $2, $1 / NCHARS deps docs LICENSE log.log model-checking parallel-orch pash-spec.sh README.md report res1 res1.txt res2.txt Rikerfile scripts test 100}' "res1"
```

This issue will likely impact other commands that use the `*` operator, potentially causing filename expansions where they are not intended.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.