Category: Knowledge

  • Useful Bash Scripts

    Prompt the user to press the Enter key before proceeding with the script execution. Check if a variable is empty Transform any uppercase letters in the input word to their corresponding lowercase letters. # hello world Assign the current date to the variable date in the format “YYYYMMDD”. Find string length Extract substring Detailed explanation: # April Find and… Read more

  • Bash Scripts Basic

    The term “shell” encompasses any software program that offers a command-line interface to interact with an operating system. Among various types of shells, “Bash” is a popular one extensively utilized in Unix/Linux systems. A bash script is a file that ends with the “.sh” extension and contains a series of commands and logic controls. When… Read more

  • Recursion : how to change from non-tail to tail

    (1) Introduce an accumulator parameter in the recursive function. Initialize the accumulator with a value that satisfies two conditions a) when the smallest value is passed from main() to the recursive function, it can correctly return the result to the main program. b) it gives the correct intermediate accumulator at the first recursive call (2)… Read more