Skip to content

bugfix one example of 010-bash-conditionals #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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