From a7809889c6bbbfdd55b21d4e9baa020c10708260 Mon Sep 17 00:00:00 2001 From: nanfeng <52900366+nknanfeng@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:27:21 +0800 Subject: [PATCH] bugfix one example of 010-bash-conditionals (#159) * bugfix conditionals * bugfix modify symbol '-' * bugfix modify ~/.bash_profile spelling --- ebook/en/content/010-bash-conditionals.md | 2 +- ebook/en/content/011-bash-loops.md | 8 ++++---- ebook/en/content/014-creating-custom-bash-commands.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ebook/en/content/010-bash-conditionals.md b/ebook/en/content/010-bash-conditionals.md index f6f5e93..a84a7cd 100644 --- a/ebook/en/content/010-bash-conditionals.md +++ b/ebook/en/content/010-bash-conditionals.md @@ -89,7 +89,7 @@ read -p "Enter your username? " username # Check if the username provided is the admin -if [[ "${username}" != "${admin}" ]] || [[ $EUID != 0 ]] ; then +if [[ "${username}" != "${admin}" ]] && [[ $EUID != 0 ]] ; then echo "You are not the admin or root user, but please be safe!" else echo "You are the admin user! This could be very destructive!" diff --git a/ebook/en/content/011-bash-loops.md b/ebook/en/content/011-bash-loops.md index 37defdd..bba9fc6 100644 --- a/ebook/en/content/011-bash-loops.md +++ b/ebook/en/content/011-bash-loops.md @@ -135,7 +135,7 @@ The [n] argument is optional and can be greater than or equal to 1. When [n] is for i in 1 2 3 4 5 do - if [[ $i –eq 2 ]] + if [[ $i -eq 2 ]] then echo "skipping number 2" continue @@ -161,9 +161,9 @@ Example: #!/bin/bash num=1 -while [[ $num –lt 10 ]] +while [[ $num -lt 10 ]] do - if [[ $num –eq 5 ]] + if [[ $num -eq 5 ]] then break fi @@ -184,7 +184,7 @@ do echo "outer loop: $a" for (( b = 1; b < 100; b++ )) do - if [[ $b –gt 5 ]] + if [[ $b -gt 5 ]] then break 2 fi diff --git a/ebook/en/content/014-creating-custom-bash-commands.md b/ebook/en/content/014-creating-custom-bash-commands.md index 762b713..1261976 100644 --- a/ebook/en/content/014-creating-custom-bash-commands.md +++ b/ebook/en/content/014-creating-custom-bash-commands.md @@ -48,7 +48,7 @@ Now if you log out and log back in, your alias would be lost. In the next step y In order to make the change persistent, we need to add the `alias` command in our shell profile file. -By default on Ubuntu this would be the `~/.bashrc` file, for other operating systems this might be the `~/.bash_profle`. With your favorite text editor open the file: +By default on Ubuntu this would be the `~/.bashrc` file, for other operating systems this might be the `~/.bash_profile`. With your favorite text editor open the file: ```bash nano ~/.bashrc