Sunday, 2 June 2013

when to use double quotes with a variable in shell script?

when to use double quotes with a variable in shell script?

I am in a confusion with what is meant by the double quotes referring to a variable. For example following two scripts gives the same output. What is really meant by the double quotes?
Script1
getent passwd | while IFS=: read a b c d e f ; do
echo login "$a" is "$d"
done
script 2
#! /bin/sh

getent passwd | while IFS=: read a b c d e f ; do

    echo login $a is $d
done

No comments:

Post a Comment