Logo My Personal Blog
  • Home
  • About
  • Skills
  • Experiences
  • Accomplishments
  • Notes
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • Posts
  • Bash Variables
  • How to test SMTP servers
Hero Image
Bash Variables Substitutions

This table summarizes Bash parameter expansions, providing a quick reference for manipulating shell variables. It covers operations like default value assignment, substring extraction, pattern removal, case conversion, and string length calculation. Parameter Expansion Description ${parameter:-defaultValue} Get default shell variables value ${parameter:=defaultValue} Set default shell variables value ${parameter:?"Error Message"} Display an error message if parameter is not set ${#var} Find the length of the string ${var%pattern} Remove from shortest rear (end) pattern ${var%%pattern} Remove from longest rear (end) pattern ${var:num1:num2} Substring ${var#pattern} Remove from shortest front pattern ${var##pattern} Remove from longest front pattern ${var/pattern/string} Find and replace (only replace first occurrence) ${var//pattern/string} Find and replace all occurrences ${!prefix*} Expands to the names of variables whose names begin with prefix. ${var,} Convert first character to lowercase. ${var,pattern} Convert first character to lowercase. ${var,,} Convert all characters to lowercase. ${var,,pattern} Convert all characters to lowercase. ${var^} Convert first character to uppercase. ${var^pattern} Convert first character to uppercase. ${var^^} Convert all character to uppercase. ${var^^pattern} Convert all character to uppercase.

    Monday, June 8, 2020 | 1 minute Read
    Hero Image
    How to test SMTP servers

    DNS lookup The first step is to find out which SMTP server(s) is responsible for the domain that you want to test, if you already know this you can skip this step. There are several command-line tools that can be used for this but here I’m using nslookup as well as dig as examples. # dig example.local mx (cut) ;; ANSWER SECTION: example.local. 3600 IN MX 10 mx1.example.local. example.local. 3600 IN MX 10 mx2.example.local. (cut) Verify connnectivity To verify if it’s possible to connect to the SMTP server you can use for example telnet or netcat.

      Monday, June 8, 2020 | 2 minutes Read
      Navigation
      • About
      • Skills
      • Experiences
      • Accomplishments
      Contact me:
      • fred@freuds.fr
      • freuds