How to join string variables in Bash

Last updated on Jul 29, 2022 by Suraj Sharma



In this tutorial, you will learn how you can concatenate two or more string variables in Bash script


There are many ways to join string in Bash but here I'll share only one example that is very efficient.


Example 1


  firstName="Suraj"
  lastName="Sharma"

  name="${firstName} ${lastName}"
  echo "${name}"
  #output: "Suraj Sharma"


Related Solutions


Rate this post


Suraj Sharma is the founder of Future Gen AI Services. He holds a B.Tech degree in Computer Science & Engineering from NIT Rourkela.