I looked some other posts and learnt to match file extension in the following way but why my code is not working? Thanks.

<br>

  1 #!/bin/sh
  2 
  3 for i in `ls`
  4 do
  5     if [[ "$i" == *.txt ]]
  6     then
  7         echo "$i is .txt file"
  8     else
  9         echo "$i is NOT .txt file"
 10     fi
 11 done


Linux Tutorial - Shell Bash Commands from the Beginning with Examples

Linux Tutorial - Shell Bash Commands from the Beginning with Examples

Linux Tutorial - Shell Bash Commands from the Beginning with Examples. Learn BASH command interpreter explained step by step and with examples. Learn what Linux is and how the command interpreter fits into the operating system. Get and install Linux. Understand the structure and syntax of Linux commands. Learn to manage the elements of the filesystem: files and directories. Learn to install software from official servers or from any compatible file.

Linux Tutorial - Shell Bash Commands from the Beginning with Examples

Learn BASH command interpreter explained step by step and with examples.

In this course you will learn to use a command interpreter in Linux. I will teach you all the necessary concepts from the beginning and step by step, so you will have a good base on which to expand your skills with this powerful way of using an Operating System. Whether you are initiated in its use or if you have never seen it, you will take advantage of the explanations and exercises that I am going to teach you.

In the first topic I will explain what Linux is and how the command interpreter fits into the operating system. You will also see how to install it using a virtual machine so you can do all the practices and experiments you want without fear that your computer will suffer some damage.

In the second block you will learn to manage the elements of the filesystem: files and directories. You will understand how they are organized and you can move about the directory structure quickly and effectively. You will also learn how to create, change or delete both files and folders.

Like Linux in a multi-user system, in the third topic you will know how users, groups and permissions are organized.

Finally you will learn to install software from official servers or from any compatible file. You will hallucinate with the amount of free programs that you can enjoy in a few seconds.

Do not hesitate, take the course and lose your fear of the console mode, your computer skills will grow exponentially!

What you'll learn

  • 🐧 Get and install Linux
  • 🏼 Understand the structure and syntax of Linux commands
  • ❓Get quick help from any system command
  • 📂 Manage your files and folders quickly and effectively
  • 🛠 Use all the tools offered by the command interpreter to be more efficient using Linux
  • 💡Understand and manage concepts such as file system paths, both relative and abusive
  • 👨‍💻Create users and assign them permissions and passwords
  • 💿 Install and configure the large amount of free software offered by Linux
  • 🕸 Modify system repositories
  • *️⃣ Use wildcards and file system shortcuts
  • 💻 Know the information offered by the system prompt

Bash alias to wrap around Git commit

I am trying to write a bash alias to wrap around a Git commit command.

I am trying to write a bash alias to wrap around a Git commit command.

Here is what my typical Git commit looks like. git commit -am 'Comments in here'

Here is what I have attempted to write as an alias (which would go inside my .bashrc file), so I don't have to write out the whole command every time.

comm(){

git commit -am $1

}

Then I would call it like this: comm 'Comments in here'

However I keep getting this error: fatal: Paths with -a does not make sense.

Anything I'm missing here?

Remove Database settings of django using bash script

I am trying to create a bash script to create a boilerplate django project that suits for my company. I need to delete the DATABASES in settings and append new one. The DATABASES is a python dictionary with structure

I am trying to create a bash script to create a boilerplate django project that suits for my company. I need to delete the DATABASES in settings and append new one. The DATABASES is a python dictionary with structure

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}

For this I tried something like this

sed -i -e "/DATABASES = {/,/}/d" settings.py

But it resulted in a trailing }.

The output is

}

I understood that the pattern it matches is for the first curly braces but not the second. What should be the approach for this.