Blog Archives

The difference between `command` and $(command)

The old style backticks ` ` and the $( ) constructions do the same thing, but treat the backslashes different. Using backticks: $ echo `echo test` test Using $( ): $ echo $(echo test) test In the $( ) construction,

Tagged with: , , , , ,
Posted in The Linux and Unix Articles!

Escaping Special Characters in Linux and Unix: With 7 Practical Examples

I have written this short article on escaping special characters here. In this article I will show you how to escape the special characters, with 7 practical examples: The escape character is \ . Example 1: I will create the

Tagged with: , , , , , ,
Posted in The Linux and Unix Articles!

3 Text Formatting Tricks: remove duplicate lines, remove empty lines, convert upper cases to lowers

In this article I will show you 3 basic text formatting tricks. It is very usefull to know how to manipulate text files. Remove repeated lines in a file: I have this file: $ cat textfile sample line1 sample line1

Tagged with: , , , , , , , , ,
Posted in The Linux and Unix Articles!

The bash wildcards: 10 practical examples of how to use them

I have previously written an article about the asterisk and question mark wildcards and another article about the square brackes and the curly brackets wildcards. In post I will give you 10 examples of how to use the wildcards in

Tagged with: , , , , ,
Posted in The Linux and Unix Articles!

Exporting variables in shell scripting

The export command is mostly used when setting up a new PATH. You need to export a variable, in order to use it globally. By default, a variable can be used only local, unless it is exported. $ x=/home/razvan $

Tagged with: , , , ,
Posted in The Linux and Unix Articles!

The exit status in shell scripting

Like in the C programs, the exit command terminates a script. It can also return a value which is read by the script’s parent process. The exit status is also known as return status or exit code. By convention, a

Tagged with: , , , , , ,
Posted in The Linux and Unix Articles!

Quoting characters in shell scripting

Quoting means putting a string in quotes. By quoting a string, we protect the special characters in the string from reinterpretation or expansion in a shell script. A special character is a character that has an different interpretation than its

Tagged with: , , , ,
Posted in The Linux and Unix Articles!

How to use the echo command in shell scripting

In Linux and Unix, the echo command is used to write text in files or at the standard output (stdout) and to display the values of variables. Examples of using echo: $ echo “Hello” Hello $ PI=3.14 $ echo $PI

Tagged with: , , , , ,
Posted in The Linux and Unix Articles!

How to use variables in shell scripting

In this article I will show you how to create variables and set values to variables. This is an easy thing to do, but very important in shell scripting. I will use echo to display the variable values. How to

Tagged with: , , , , , ,
Posted in The Linux and Unix Articles!

How to insert comments in shell scripts

In shell scripting, # is used for inserting comments. Every line beginning with # (except the shebang #!) will not be executed! # this is a commented line! Comments can also occur following the end of a command. echo “hello”

Tagged with: , , ,
Posted in The Linux and Unix Articles!
Support LinuxG via Patreon
Support LinuxG.net on Patreon!
Subscribe

  

Subscribe to get the latest Linux news and how to guides directly on your e-mail!