AFAI understand you want to use an array:
read -r -a names
Example:
read -r -a names <<< "John Marry Sanford Saunders"
echo "${names[0]}" # John
echo "${names[1]}" # Marry
echo "${names[2]}" # Sanford
echo "${names[3]}" # Saunders
More Related Contents:
- How can I check if a directory exists in a Bash shell script?
- How do I set a variable to the output of a command in Bash?
- Why is testing “$?” to see if a command succeeded or not, an anti-pattern?
- How to convert a string to lower case in Bash?
- ‘\r’: command not found – .bashrc / .bash_profile [duplicate]
- How can I detect if my shell script is running through a pipe?
- How do I run a shell script without using “sh” or “bash” commands?
- How can I suppress all output from a command using Bash?
- Bash: limit the number of concurrent jobs? [duplicate]
- How to get a password from a shell script without echoing
- Exit Shell Script Based on Process Exit Code [duplicate]
- Pass all variables from one shell script to another?
- Checking if output of a command contains a certain string in a shell script
- Bash conditional based on exit code of command
- How to make awk ignore the field delimiter inside double quotes? [duplicate]
- Passing arguments by reference
- Get just the filename from a path in a Bash script [duplicate]
- Rename multiple files in shell [duplicate]
- Is there a way to make bash job control quiet?
- Get current directory or folder name (without the full path)
- How do file descriptors work?
- Convert Unix timestamp to a date string
- Using Bash to display a progress indicator (spinner) [duplicate]
- When does command substitution spawn more subshells than the same commands in isolation?
- Extract version number from a string
- Temporarily change current working directory in bash to run a command [duplicate]
- How to break out of a loop in Bash?
- How to tell if a string is not defined in a Bash shell script
- BASH: Writing a Script to Recursively Travel a Directory of N Levels
- How to grep for case insensitive string in a file?