Files
Hiroyuki Sato d0f318d1da GH-51485: [C++] Fix SC2086 errors in cpp/examples/tutorial_examples directory (#51486)
### Rationale for this change

This is the sub issue #44748.

```
In build_arrow.sh line 23:
mkdir -p $ARROW_BUILD_DIR
         ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
mkdir -p "$ARROW_BUILD_DIR"

In build_arrow.sh line 24:
pushd $ARROW_BUILD_DIR
      ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
pushd "$ARROW_BUILD_DIR"

In build_arrow.sh line 33:
    $ARROW_CMAKE_OPTIONS
    ^------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
    "$ARROW_CMAKE_OPTIONS"

In build_arrow.sh line 35:
make -j$NPROC
       ^----^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
make -j"$NPROC"

In build_example.sh line 21:
mkdir -p $EXAMPLE_BUILD_DIR
         ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
mkdir -p "$EXAMPLE_BUILD_DIR"

In build_example.sh line 22:
pushd $EXAMPLE_BUILD_DIR
      ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
pushd "$EXAMPLE_BUILD_DIR"

In build_example.sh line 24:
cmake /io $EXAMPLE_CMAKE_OPTIONS
          ^--------------------^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean:
cmake /io "$EXAMPLE_CMAKE_OPTIONS"

For more information:
  https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ...
```

### What changes are included in this PR?

* SC2086: Quote variables

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.

### Was AI used for this PR?

**PR code and description written by:**

- [x] Human
- [ ] AI

**Reviewed before submission by:**

- [x] Human
- [ ] AI
- [ ] Not reviewed

* GitHub Issue: #51485

Authored-by: Hiroyuki Sato <hiroysato@gmail.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
2026-09-29 06:37:22 +09:00

32 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -ex
mkdir -p "$EXAMPLE_BUILD_DIR"
pushd "$EXAMPLE_BUILD_DIR"
# Convert the space-separated CMake options into a Bash array.
# This avoids ShellCheck SC2086 and preserves argument boundaries.
read -r -a EXAMPLE_CMAKE_OPTIONS_ARRAY <<< "$EXAMPLE_CMAKE_OPTIONS"
cmake /io "${EXAMPLE_CMAKE_OPTIONS_ARRAY[@]}"
make
popd