<commit_before>#!/bin/bash

# This script takes the argument as a filename and copies it to all mbeds attached!

if [ ! -e "$1" ]; then
	echo "File $1 not found..."
	exit 1
fi

if [ ! -e "/dev/disk/by-id" ]; then
	echo "Your linux distro is not supported =("
	exit 2
fi

MBED_DEVICES="$(ls /dev/disk/by-id/ | grep mbed)"

# This prepends the directory structure to all found mbed devices
MBED_DEVICES_PATH="$(ls /dev/disk/by-id/ | grep mbed | sed 's\.*\/dev/disk/by-id/&\g')"

if [ -z $MBED_DEVICES ]; then
	echo "No mbed device detected!"
	exit 3
fi

echo -e Attempting to mount $MBED_DEVICES
echo -e Devices path is $MBED_DEVICES_PATH


sudo mkdir -p /mnt/script/MBED
sudo mount $MBED_DEVICES_PATH /mnt/script/MBED
sudo cp $1 /mnt/script/MBED/
sudo umount /mnt/script/MBED/
sudo rmdir /mnt/script/MBED

# echo  $(ls /dev/disk/by-id/ | grep mbed)<commit_msg>Added multiple mbed support and conform to style. Fixes issue #156<commit_after>#!/bin/bash

# This script takes the argument as a filename and copies it to all mbeds attached!

# this causes the script to fail if any command below fails
set -e

# checks for file existence
if [ ! -e "$1" ]; then
    echo "File $1 not found..."
    exit 1
fi

# checks to see if the device files used are present
if [ ! -e "/dev/disk/by-id" ]; then
    echo "Your linux distro is not supported =("
    exit 2
fi

MBED_DEVICES="$(ls /dev/disk/by-id/ | grep mbed)"

# This prepends the directory structure to all found mbed devices
MBED_DEVICES_PATH="$(ls /dev/disk/by-id/ | grep mbed | sed 's\.*\/dev/disk/by-id/&\g')"

# errors out if no mbed devices were found
if [ -z $MBED_DEVICES ]; then
    echo "No mbed device detected!"
    exit 3
fi

echo -e Devices path is $MBED_DEVICES_PATH

# use newlines as delimiters in the forloop, rather than all whitespace
IFS=$'\n'

# loop through all mbed devices, mount them, copy over the bin file, and unmount them
for i in $MBED_DEVICES_PATH; do
    echo Installing on $i
    sudo mkdir -p /mnt/script/MBED
    sudo mount $i /mnt/script/MBED
    sudo cp $1 /mnt/script/MBED/
    sudo umount /mnt/script/MBED/
    sudo rmdir /mnt/script/MBED
done

{'fraction_non_alphanumeric': 0.11590802440168935, 'fraction_numerical': 0.0070389488503050214, 'mean_word_length': 3.1886051080550097, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5250180', 'n_tokens_mistral': 807, 'n_tokens_neox': 766, 'n_words': 288}