diff --git "a/sh/tests/solutions/\"\\?$*'First_file'*$?\\\"" "b/sh/tests/solutions/\"\\?$*'First_file'*$?\\\"" new file mode 100644 index 00000000..f9406d9c --- /dev/null +++ "b/sh/tests/solutions/\"\\?$*'First_file'*$?\\\"" @@ -0,0 +1 @@ +Random text inside! \ No newline at end of file diff --git a/sh/tests/strange-files_test.sh b/sh/tests/strange-files_test.sh new file mode 100755 index 00000000..117af30e --- /dev/null +++ b/sh/tests/strange-files_test.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +# Unofficial Bash Strict Mode +set -euo pipefail +IFS=' +' + +diff student/\"\\?\$*\'First_file\'*\$?\\\" solutions/\"\\?\$*\'First_file\'*\$?\\\" diff --git a/subjects/strange-files/README.md b/subjects/strange-files/README.md new file mode 100644 index 00000000..13f41c44 --- /dev/null +++ b/subjects/strange-files/README.md @@ -0,0 +1,43 @@ +## Strange Files + +We come across files and folders name very regularly. In most of the cases file/folder names are related to the content of the file/folder and starts with numbers or letters. Alpha-Numeric file name are pretty common and very widely used, but this is not the case when we have to deal with file/folder name that has special characters in them. + +Example of most common file names are: + +```console +something.txt +alphanum21.txt +674659.txt +``` + +Examples of file names that have special characters: + +```console +#121day.txt +some/file#.txt +*File$*.txt +``` + +When You create a file with some special character, you will need to `escape` those special characters in order to create that file. + +A non-quoted backslash `\` is the escape character. The backslash `\` preceding a character tells the shell to interpret that special character literally. + +Example: + +If you want to create a file named `foo!\.txt` You have to escape the characters like so: + +```console +User-> code foo\!\\.txt +``` + +### Instructions + +Create a file `"\?$*'First_file'*$?\"` that will contain `Random text inside!` and **nothing else**. + +### Usage + +```console +User-> ls | cat -e +"\?$*'First_file'*$?\"$ +User-> +```