shell-scripting/grep/generate_files_with_problematic_names

82 lines
2.1 KiB
Bash

#!/usr/bin/env bash
# Usage: ./generate_files_with_problematic_names
# or
# bash generate_files_with_problematic_names
# Description: (see scriptname!)
# Author: Patrick Neumann (patrick@neumannsland.de)
# Version: 1.0
# Date: 27.02.2018
# License: GPL3
# Warranty: This program is distributed WITHOUT ANY WARRANTY
# Todo: Find and add more problems in filenames!?
# Possible candidates: < > , ; = [ ] " / | \
# Zielverzeichnis
FWPN="files_with_problematic_names"
echo "Creating target directory..."
mkdir "${FWPN}"
cd "${FWPN}"
# fwpn = f(iles)w(ith)p(roblematic)n(ames)
# meier, meyer, mayer are mayr similar lastnames
# regular file
echo "Creating regular file..."
echo "fwpn:word:meier" > word.txt
# regular file
echo "Creating file with underscore..."
echo "fwpn:underscore:meyer" > underscore_instead_of_space.txt
# hidden file
echo "Creating hidden file..."
echo "fwpn:hidden:mayer" > .hidden.txt
# leading ..
echo "Creating file with two leading dots..."
echo "fwpn:two dots:mayr" > ..two_dots.txt
# leading ...
echo "Creating file with three leading dots..."
echo "fwpn:three dots:meier" > ...three_dots.txt
# leading hyphen (-)
echo "Creating file with leading hyphen..."
echo "fwpn:leading hyphen:meyer" > ./-leading_hyphen.txt
# star (*)
echo "Creating file with star..."
echo "fwpn:with star:mayer" > with_*.txt
# backslash (\)
echo "Creating file with backslash..."
echo "fwpn:with backslash:mayr" > "with_\.txt"
# (leading) blank
echo "Creating file with leading blank..."
echo "fwpn:blank at the beginning:meier" > " blank.txt"
# blank (separator)
echo "Creating file with blank..."
echo "fwpn:blank as separator:meyer" > "blank as separator.txt"
# newline
echo "Creating file with newline..."
echo "fwpn:newline as separator:mayer" > "newline_as
separator.txt"
# tabulator
echo "Creating file with tablulator..."
echo "fwpn:tabulator as separator:mayr" > tab_as$'\t'separator.txt
# questionmark (?)
echo "Creating file with questionmark..."
echo "fwpn:with questionmark:meier" > "with_?.txt"
# colon (:)
echo "Creating file with colon..."
echo "fwpn:colon:meyer" > with_:.txt
exit 0