bash: find last occurrence of a character in a string

linux count characters, words, lines

When writing shell scripts, you usually run into use cases where you want to manipulate text strings. Here we will see how you can find the last occurence of a single character in a string and then use that information to manipulate text or strings. For the purpose of this post, we will consider the character that we can to…

how to use ‘for’ loop in bash shell scripts

for loop in bash

If you have done any programming in any language, you should be familiar with loops. Almost all computer programming languages have some version of a loop statement. It is a language construct that allows you to execute a specific piece of code repeatedly, often with different set of data. In this post, we will talk specifically about the for loop…

how to delete a folder or directory in linux

Linux command line delete files

The Linux command to delete a folder or directory is the same as the one to delete a file. You can use the rm command to delete both files and folders. Deleting an empty directory is easy enough but if you try to remove a directory that has files in them, you will get an error. deleting an empty folder…