numerous small fixes

This commit is contained in:
anon
2024-06-12 22:04:48 +02:00
parent 018c34a408
commit 57802f36a3
6 changed files with 26 additions and 12 deletions

View File

@ -23,9 +23,9 @@ function description() {
"- Bash removes them before handing the argument to echo." \ "- Bash removes them before handing the argument to echo." \
"echo prints this single argument out just like it always does." "echo prints this single argument out just like it always does."
echo "" echo ""
echo "touch is another common program" \ echo -e "${YELLOW}touch${NORMAL} is another common program" \
"used for creating empty files or updating their" \ "used for creating empty files or updating their" \
"file access dates." "file access dates."
echo "" echo ""
echo -e "${BLUE}# Commit a war crime by creating a file with a space in its name!${NORMAL}" echo -e "${BLUE}# Commit a war crime by creating a file with a space in its name!${NORMAL}"
} }

View File

@ -6,7 +6,7 @@ function description() {
"except they don't reside in separate files," \ "except they don't reside in separate files," \
"and they don't cause a separate process to be executed." \ "and they don't cause a separate process to be executed." \
"However, they take arguments just like scripts. Take this for example:${YELLOW}" "However, they take arguments just like scripts. Take this for example:${YELLOW}"
echo " $ sum() {" echo " $ function sum() {"
echo ' > echo "$1 + $2 = $(($1 + $2))' echo ' > echo "$1 + $2 = $(($1 + $2))'
echo " > }" echo " > }"
echo -e "${NORMAL}" echo -e "${NORMAL}"

View File

@ -1,4 +1,11 @@
function description() { function description() {
FILES="a aa aaa aaaa \
b bb bbbb \
c ccc cccc \
bc bd bk \
baaab booob biiib buuub beeeb bűb"
touch $FILES
echo "Globs are a type of pattern matching." \ echo "Globs are a type of pattern matching." \
"They can be used to match filenames or other strings." "They can be used to match filenames or other strings."
echo "" echo ""
@ -16,13 +23,20 @@ function description() {
"because it only matches the at, not the whole string." \ "because it only matches the at, not the whole string." \
"A glob of ca*, however, would match cat." "A glob of ca*, however, would match cat."
echo "" echo ""
echo -e "${BLUE}# ?!.${NORMAL}" echo -e "${BLUE}# A bunch of files have been created in your directory." \
"Glob your way out of this hole by producing the printing the exact text" \
"as below!${NORMAL}"
echo -e "${GREEN}a aa aaa aaaa bc bűb aaaa bbbb cccc${NORMAL}"
} }
function hint() { function hint() {
echo "" echo "The first 3, the next 1, the next 1 after that and" \
"the closing 3 belong to the same pattern."
} }
function validate() { function validate() {
true if [ "$($*)" == "a aa aaa aaaa bc bűb aaaa bbbb cccc" ]; then
rm $FILES
return 1
fi
} }

View File

@ -1,5 +1,5 @@
function description() { function description() {
echo -e "${GREEN}That is about it for this guide.${NORMAL}" echo -e "${GREEN}${BOLD}That is about it for this guide.${NORMAL}"
echo "" echo ""
echo "We have touched on every big concept regarding Bash." \ echo "We have touched on every big concept regarding Bash." \
"However you should know that the devil is in the details." \ "However you should know that the devil is in the details." \

View File

@ -1,4 +1,4 @@
alias surprise='echo good job' alias surprise_alias='echo good job'
function description() { function description() {
if [ -n "${FMT_WIDTH}"]; then if [ -n "${FMT_WIDTH}"]; then
@ -86,9 +86,9 @@ function hint() {
} }
function validate() { function validate() {
if [ "$1" == "surprise" ]; then if [ "$1" == "surprise_alias" ]; then
unset FMT_WIDTH unset FMT_WIDTH
unalias surprise unalias surprise_alias
return 1 return 1
fi fi
} }

View File

@ -12,7 +12,7 @@ function description() {
echo "" echo ""
echo -e "Running bash scripts is similarly easy." \ echo -e "Running bash scripts is similarly easy." \
"You can just pass the file name as an argument to the" \ "You can just pass the file name as an argument to the" \
"'${ITALICS}bash${NORMAL}' program." "'${YELLOW}bash${NORMAL}' program."
echo "" echo ""
echo -e "${BLUE}# Create your first Bash script (it can be anything) and run it${NORMAL}" echo -e "${BLUE}# Create your first Bash script (it can be anything) and run it${NORMAL}"
} }