Skip to content

Commit

Permalink
bugfix one example of 010-bash-conditionals (#159)
Browse files Browse the repository at this point in the history
* bugfix conditionals

* bugfix modify symbol '-'

* bugfix modify ~/.bash_profile spelling
  • Loading branch information
nknanfeng authored Sep 27, 2024
1 parent b08e01f commit a780988
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ebook/en/content/010-bash-conditionals.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!"
Expand Down
8 changes: 4 additions & 4 deletions ebook/en/content/011-bash-loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ebook/en/content/014-creating-custom-bash-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a780988

Please sign in to comment.