What is the difference between $* and $@ in bash shell script?



  • Also see: What is the difference between "$*" and "$@" in a bash shell script?

    Difference between $* and $@

    echo $*
    echo $@
    
    for i in $*
    do
      echo $i
    done
    
    for i in $@
    do
      echo $i
    done
    

    Results, everything is the same, no difference.

    $ ./positional_parameters If you see a faded sign at the side of the road that says...
    If you see a faded sign at the side of the road that says...
    If you see a faded sign at the side of the road that says...
    If
    you
    see
    a
    faded
    sign
    at
    the
    side
    of
    the
    road
    that
    says...
    If
    you
    see
    a
    faded
    sign
    at
    the
    side
    of
    the
    road
    that
    says...
    


© Lightnetics 2024