Learn different ways to store a MySQL result set within a Bash array in Linux.
Also find me here:
Baeldung Author
Jimmy Azar
Jimmy Azar is a contributing author at Baeldung. His work primarily focuses on Linux, data, and automation. He enjoys scripting in Python and Bash, and follows the Unix philosophy for writing programs.
Here's what I've written (so far):
Baeldung on Linux
- All
- Scripting (35)
- Administration (9)
- Files (6)
- Networking (4)
- File Editing (4)
- Processes (2)
- File Viewing (2)
- File Searching (2)
- Security (1)
- Search (1)
- File Permissions (1)
Do Functions Run as Subprocesses in Bash?
Learn about the relation between Bash functions and subprocesses.
Verifying MD5 Hash Values for a Large Number of Files
Learn ways to automate the verification of each MD5 hash for a large number of files.
How to Output Text in a Bash Loop Until a Keyboard Key Event
Filed under Scripting
Learn how to create a Bash loop to output text but also poll for a keyboard key event.
Listening for Multiple TCP Connections From the Shell
Filed under Networking
Learn several ways to listen for multiple TCP connections on the same port from the shell.
How to Pipe Commands After xargs in a Pipeline
Filed under Administration, Scripting
Learn the proper syntax to chain commands after xargs.
How to Specify a Working Directory for a systemd Service
Filed under Administration, Scripting
Learn how to set the current working directory for a systemd unit.
How to Find Files of a Specific Type Lacking an Extension
Filed under File Searching
Learn how to find files by type in Linux.
How to Remove Multiple Files Using SFTP
Filed under Files, Networking
Learn how to remove more than one file at a time through SFTP.
Linux Command Line Base64 Encoding and Decoding of Strings
Filed under Security
Learn to use the tools for encoding and decoding Base64 strings in the Linux command line.
How to Copy Latest File From One Directory to Another
Filed under Scripting
Learn how to copy the most recent file from a given directory to another path.
Get and Manipulate Subnet Mask in Bash
Filed under Networking, Scripting
Learn ways to get the subnet mask of a network and transform it between the CIDR and dotted decimal formats.
Filter Log File Entries Based on Date Range
Filed under Administration, Scripting
Learn how to filter logs by one or more given date ranges via Bash.
Defining a Hash Table in Bash
Filed under Scripting
Learn how to use the hash table equivalent available in recent versions of Bash.
How to Export Variables From a File
Learn how to get variable declarations from a file and export them to the shell environment.
Check if a Number Is a Prime in Bash
Filed under Scripting
Learn how to check whether a given number is prime with Bash and the coreutils package.
How to Assign Default Value to a Variable Using Bash
Filed under Scripting
Learn how to assign a default value to a variable based on its current value in Bash.
How to Extract the Last n Characters of a String in Bash
Filed under Scripting
Learn how to extract a given number of a characters from the end of a string via shell tools in Linux.
Check if the find Command Returns a Match
Learn ways to verify the find command actually returns results.
How to Call Python From a Bash Script
Filed under Scripting
Learn several ways to call and run Python code via the Linux shell.
How to Compare Time in Shell
Filed under Scripting
Learn several ways to compare times in the shell.
How to Verify the Length of a Variable in Bash
Filed under Scripting
Learn ways to check and verify the length of a shell variable.
Checking the Validity of an IP Address in Linux
Filed under Networking, Scripting
Learn how to use the shell for verifying whether an IP version 4 or version 6 address is valid.
Importing Multiple SQL Dump Files Into MySQL From the Command Line
Filed under Administration, Files
Learn how to import SQL dumps separately and simultaneously into a MySQL database.
How to Use Bash Script to Insert Values in MySQL DB
Filed under Scripting
Learn ways to run queries and insert data into a database from the shell.
How to List Files by Type With ls
Filed under Administration
Learn ways to filter the output of ls by file type and find out how to extract only filenames.
Bash One-Liners to Remove Characters From a Variable
Filed under Scripting
Learn how to remove given characters from a Bash variable using different tools.
How to Toggle Comments in a File From the CLI
Filed under File Editing, Scripting
Learn how to comment and uncomment specific lines of a file using the command line interface.
Changing Command-Line Arguments in Bash
Filed under Scripting
Learn ways to dynamically modify command-line arguments within an existing environment or script.
How to Print a Given Number in Reverse Order
Filed under Scripting
Learn how to reverse a signed or unsigned integer or floating-point number in the shell.
Returning a Regular Expression (Regex) Match in the Shell
Filed under Scripting
Learn many ways to apply a regular expression to a string and return the matches.
How to Cut a Field From Text Line Counting From the End
Filed under File Editing, Scripting
Learn different methods to extract file line fields relative to the last one.
Checking the Scheduled Time of a Delayed Shutdown in Linux
Filed under Administration
Learn how to find the exact time at which a Linux system is expected to shut down.
How to Output Comma-Separated Strings Using Bash Brace Expansion
Filed under Scripting
Learn multiple ways to convert a Bash brace expansion value to a comma-separated list.
How to Carry Out Multiple Substitutions in a File Using a Single sed Command
Filed under File Editing
Learn how to perform several substitutions within the same file at once in a single sed command.
Matching Uppercase and Lowercase Letters With Regex in Shell
Filed under Scripting
Learn how to match uppercase and lowercase strings, as well as ignore the case when using regular expressions in the shell.
How to Replace a Character in a Matched Line In-Place
Filed under File Editing, Scripting
Learn how to change characters in a specific line of a file based on patterns.
How to Use chmod Without /usr/bin/chmod
Filed under Administration, File Permissions
Learn many ways to change file permissions without using /usr/bin/chmod.
How to Delete Text Before a Delimiter From the Command Line
Filed under Scripting
Learn several ways to remove the start or end of a line based on delimiters.
Run Arbitrarily Complex Commands Using sudo Over SSH
Filed under Administration
Learn about easily running complex sudo commands through interactive and non-interactive SSH sessions.
How to Use the Ternary Conditional Operator in Bash
Filed under Scripting
Learn about ternary expressions using the Bash conditional operator.
Showing the Definition of a Function in Bash
Filed under Scripting
Learn ways to get the location and definition of a given Bash function.
How to Run a Command in the Background With a Delay
Filed under Scripting
Learn ways to run commands in the background with a delay.
Matching Multiple Conditions in One case Statement in Shell
Filed under Scripting
Learn how to match more than one condition with a single Bash case statement.
How to Find the “n” Most Frequent Words in a File
Filed under File Searching, File Viewing
Learn how to find the n most frequent words in a file in Linux using a combination of command-line tools such as tr, sort, uniq, and head.
Transposing a File From the Command Line
Filed under File Viewing
Learn how to transpose the rows and columns of a file from the command line on Linux.
How to Extract “n” Characters Before and After a Match in Shell
Filed under Scripting
Learn how to extract a pattern and the n characters preceding and following it in Bash.
Finding Unique Text Between Two Files
Filed under Files
Learn how to find unique text between two files in Linux using a variety of methods, including command line tools like comm, diff, grep, and awk.
Get PID of a Just-Started Process
Filed under Administration, Processes
Learn about ways to know the PID of a process that just started.
Reversing the List of Words in a Bash String
Filed under Scripting
Learn ways to reverse the order of words within a Bash string.