Reading parameters is easy, but how to read parameters with spaces?
We usually wrap them with parenthesis right? But actually how?

#!/bin/bash

whitespace="[[:space:]]"
for i in "$@"
do
    if [[ $i =~ $whitespace ]]
    then
        i=\"$i\"
    fi
    echo $i
done


Published

12 February 2018

Category

operation

Tags