foo="Hello" foo="${foo} World" echo "${foo}" > Hello World
In general to concatenate two variables you can just write them one after another:
a='Hello' b='World' c="${a} ${b}" echo "${c}" > Hello World
Related Posts:
- How do I iterate over a range of numbers defined by variables in Bash?
- How do I iterate over a range of numbers defined by variables in Bash?
- What does “-ne” mean in bash?
- How do I split a string on a delimiter in Bash?
- Ubuntu says “bash: ./program Permission denied” [closed]
- -bash: syntax error near unexpected token `)’
- An example of how to use getopts in bash
- “unary operator expected” error in Bash if condition
- What is the purpose of “&&” in a shell command?
- How to generate random number in Bash?
- How to check if a variable is set in Bash?
- How can I compare numbers in Bash?
- Open and write data to text file using Bash?
- How do I set a variable to the output of a command in Bash?
- Is there a TRY CATCH command in Bash
- Run a string as a command within a Bash script
- Meaning of “! -S” in shell script
- “No such file or directory” but it exists
- How do I pause my shell script for a second before continuing?
- In the shell, what does ” 2>&1 ” mean?
- Is double square brackets [[ ]] preferable over single square brackets [ ] in Bash?
- Extract substring in Bash
- Should I put #! (shebang) in Python scripts, and what form should it take?
- Should I put #! (shebang) in Python scripts, and what form should it take?
- In the shell, what does ” 2>&1 ” mean?
- How do I copy a folder from remote to local using scp?
- How to grep for case insensitive string in a file?
- Difference between wait and sleep
- Multi-line string with extra space (preserved indentation)
- How to delete from a text file, all lines that contain a specific string?
- How to make “if not true condition”?
- ‘\r’: command not found – .bashrc / .bash_profile [duplicate]
- How to mkdir only if a directory does not already exist?
- -bash: syntax error near unexpected token `newline’
- Loop through an array of strings in Bash?
- How can I check if a directory exists in a Bash shell script?
- How to set ssh timeout?
- commands not found on zsh
- Why do people write #!/usr/bin/env python on the first line of a Python script?
- -bash: syntax error near unexpected token `newline’ for display command
- Using find to locate files that match one of multiple patterns
- How to reload .bashrc settings without logging out and back in again?
- Is there a Python equivalent to the ‘which’ command
- How can I declare and use Boolean variables in a shell script?
- Replace one substring for another string in shell script
- How do I split a string on a delimiter in Bash?
- Pseudo-terminal will not be allocated because stdin is not a terminal
- What is a list in Bash?
- What does the line “#!/bin/sh” mean in a UNIX shell script?
- How can I count all the lines of code in a directory recursively?
- How can I kill a process by name instead of PID, on Linux?
- Which characters need to be escaped when using Bash?
- How to remove the quotes when reading a variable in jq in shell?
- Shell script “for” loop syntax
- Shell: How to call one shell script from another shell script?
- Ternary operator (?:) in Bash
- Pseudo-terminal will not be allocated because stdin is not a terminal
- find: missing argument to -exec
- How to escape single quotes within single quoted strings
- python getoutput() equivalent in subprocess
- ./configure : /bin/sh^M : bad interpreter
- How to check if an environment variable exists and get its value?
- Bash syntax error: unexpected end of file
- How to convert a string to lower case in Bash?
- dquote> result of a execution a program in linux shell
- Using sudo with Python script
- how to fix the issue “Command /bin/sh failed with exit code 1” in iphone
- Create a new file in git bash
- conditional binary operator expected in shell script
- How to specify the private SSH-key to use when executing shell command on Git?
- Block Comments in a Shell Script
- Sorting data based on second column of a file
- Writing a simple shell in C using fork/execvp
- Speed up rsync with Simultaneous/Concurrent File Transfers?
- Multi-dimensional arrays in Bash
- Variable interpolation in the shell
- chmod: changing permissions of ‘my_script.sh’: Operation not permitted
- What’s the meaning of the parameter -e for bash shell command line?
- zip error – Nothing to do
- How to sort an array in Bash
- What does set -e mean in a bash script?
- What does set -e mean in a bash script?
- Check existence of input argument in a Bash shell script
- Associative arrays in Shell scripts
- How to split one string into multiple strings separated by at least one space in bash shell?
- Copy multiple files from one directory to another from Linux shell
- Shell script not running, command not found
- source command not found in sh shell
- How to get a shell environment variable in a makefile?
- Difference between sh and Bash
- What are the uses of the exec command in shell scripts?
- Shell Script: Execute a python program from within a shell script
- How to parse XML in Bash?
- sed whole word search and replace
- How do I know the script file name in a Bash script?
- What is “-bash: !”: event not found”
- Colors in bash after piping through less?
- What’s the difference betwen the single dash and double dash flags on shell commands?
- How to run command as user who has /usr/sbin/nologin as Shell?
- How to let ‘cp’ command don’t fire an error when source file does not exist?