Skip to content
#!/bin/bash

Month: October 2023

bash if else shorthand

shorthand if – else in bash

Posted on 2023-10-18 | by root | 2 Comments on shorthand if – else in bash

For some simple if-else conditions you may want to avoid having whole if; then; else; fi type of code. Instead, you can do it all in one bash if shorthand line. Here is how.

Continue reading →
Posted in Tips and tricks, Tutorials
bash print recursively

print all combinations from given range recursively

Posted on 2023-10-07 | by root

Sometimes you may encounter situations, when you wish to display all possible combinations of characters from given charset (e.g. some brute-force task). For example, print “a … zzz”, i.e. range is “a … z” and maximum length is 3. You can easily do this in bash (print recursively).

Continue reading →
Posted in Articles
bash hello world

“Hello World” in bash

Posted on 2023-10-05 | by root

Let’s suppose that you have just opened Linux terminal for the first time in your life. Your wish is to write nothing but bash “hello world” type of thing. As this command is one-liner, you can simply do this:

Continue reading →
Posted in Articles, Tutorials

Recent Posts

  • bash generates random fun
  • exponential search in bash
  • dealing with float numbers in bash
  • loops in Linux shell scripts
  • negate something in regex using negative lookahead
  • convert wildcard in file name into relevant static file name
  • check ownership and permissions for absolute path easily
  • retrieving country codes from IP automatically
  • check if json is valid
  • redirect both stdout and stderr to same place

Archives

  • January 2025
  • August 2024
  • June 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
© 2025 shscripts.com | contact me: IN