Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Fix bash lint with shellcheck #1475

Merged
merged 1 commit into from
Feb 24, 2017
Merged

Conversation

lukeyeager
Copy link
Member

No description provided.

@lukeyeager lukeyeager merged commit a91a51a into NVIDIA:master Feb 24, 2017
@lukeyeager lukeyeager deleted the shellcheck branch February 24, 2017 18:04
@StevenPuttemans
Copy link

Actually just confirmed, using latest DIGITS5.1-dev branch, that this breaks down the bash script for creating the databases of the tutorials for finetuning.

When taking the original file, as fixed here, running

./create_dataset.sh /data/DIGITS/datasets/odd_or_even_dataset /data/DIGITS/datasets/mnist/train

results into

cp: cannot stat '/data/DIGITS/datasets/mnist/train/0/*.png': No such file or directory
cp: cannot stat '/data/DIGITS/datasets/mnist/train/2/*.png': No such file or directory
cp: cannot stat '/data/DIGITS/datasets/mnist/train/4/*.png': No such file or directory
cp: cannot stat '/data/DIGITS/datasets/mnist/train/6/*.png': No such file or directory
cp: cannot stat '/data/DIGITS/datasets/mnist/train/8/*.png': No such file or directory
cp: cannot stat '/data/DIGITS/datasets/mnist/train/1/*.png': No such file or directory
cp: cannot stat '/data/DIGITS/datasets/mnist/train/3/*.png': No such file or directory
cp: cannot stat '/data/DIGITS/datasets/mnist/train/5/*.png': No such file or directory
cp: cannot stat '/data/DIGITS/datasets/mnist/train/7/*.png': No such file or directory
cp: cannot stat '/data/DIGITS/datasets/mnist/train/9/*.png': No such file or directory

Simply reverting adding the double brackets fixes the issue here. My create_datasets.sh script now looks like

#!/bin/sh
# Copyright (c) 2016-2017, NVIDIA CORPORATION.  All rights reserved.

if [ "$#" -ne 2 ] || ! [ -d "$2" ]; then
  echo "Usage: $0 <NEW_DATASET_DIR> <MNIST_DIR>" >&2
  exit 1
fi

NEW_DATASET_DIR=$1
MNIST_DIR=$2

# create new dataset directories
mkdir -p $NEW_DATASET_DIR/odd
mkdir -p $NEW_DATASET_DIR/even

# create symbolic links
for digit in 0 2 4 6 8
   do cp $MNIST_DIR/$digit/*.png $NEW_DATASET_DIR/even/
done
for digit in 1 3 5 7 9
   do cp $MNIST_DIR/$digit/*.png $NEW_DATASET_DIR/odd/
done

@StevenPuttemans
Copy link

Ow and this was run on Ubuntu16.04 x64!

Will report if other fixes raise the same issues.

@gheinrich
Copy link
Contributor

Whoops, well spotted! Brackets inhibit wild cards indeed!

@StevenPuttemans
Copy link

You are welcome, might want to fix this soon, since it is kind of the introduction to the software for new users and a reason to stop trying for people not understanding the internals that well.

@StevenPuttemans
Copy link

Guys thx for fixing. @lukeyeager it seems that this PR has a lot of other files where a * wildcard is encapsulated into double brackets. My guess it will raise issues everywhere?

For example: https://github.com/NVIDIA/DIGITS/pull/1475/files#diff-46b858b35b1cad2c4242df5b0f93d0f8R14

@lukeyeager
Copy link
Member Author

Ugh. My bad again 😞

ethantang95 pushed a commit to ethantang95/DIGITS that referenced this pull request Jul 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants