BASH

Create time stamp based file to store information using shell scripting

  • Posted on: 17 May 2020
  • By: dexter

As an administrator or GNU/Linux enthusiast you might come across a requirement of logging information from you shell scripts into files whenever they are run.  We would love to do this if the files created have a unique name and also give out information when it was created.

In this post we will see how we can achieve that.

टाइम स्टैम्प पर आधारित फाइल शैल स्क्रिप्ट में कैसे बनाएं और उसमें डेटा कैसे स्टोर करें।

  • Posted on: 17 May 2020
  • By: dexter

ग्न्यू/लिनक्स एडमिनिस्ट्रेटर होते हुए आपको कभी ना कभी शेल स्क्रिप्ट के जरिए फाइल बनाने की आवश्यकता पड़ेगी इस फाइल का नाम यूनिक होना चाहिए और इसी फाइल में शेल स्क्रिप्ट से आप इंफॉर्मेशन कैसे लिखेंगे ।आइए इस पोस्ट में देखें।

Adding multiple users to Linux using BASH

  • Posted on: 29 April 2020
  • By: dexter

Some or the other time as a sys admin you will come across a need to add multiple users to your Linux system. So the question is how to do the same.

Let us see how we can do the same in this post.

We will assume that N number of users are to be added with a standard prefix or suffix and values incrementing with numbers. e.g.  employee27... emp28.. etc

The command to add a user is useradd

The command can be simply run as:

How to check previous command status in BASH?

  • Posted on: 23 April 2020
  • By: dexter

BASH is the default shell in GNU/Linux systems.  While writing BASH scripts sometimes it become necessary to take action based upon the success of previous command. So how do we do this.

First we need to understand that almost every command that is run once completed returns a exit code, 99% of commands just use 0 for success, 1 for failure. Without getting into other details, lets see how we can use this value.