Bash Word splitting

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • Set IFS to newline: IFS=$'\n'
  • Set IFS to nullstring: IFS=
  • Set IFS to / character: IFS=/

Parameters

ParameterDetails
IFSInternal field separator
-xPrint commands and their arguments as they are executed (Shell option)

Remarks

  • Word splitting is not performed during assignments e.g newvar=$var
  • Word splitting is not performed in the [[ ... ]] construct
  • Use double quotes on variables to prevent word splitting


Got any Bash Question?