Quote:
Originally Posted by sam4now
And pls can give an explanation of the code in details
Thanks
|
set -A ARGS $@ defines ARGS as an array and initializes it with the script arguments.
$@ is the list of arguments itself.
FILE=${ARGS[$(expr $# - 1)]} assigns the last argument to the FILE variable. This is the way arrays are managed on ksh
$# is the number of arguments, so
expr $# -1 is the position of the last one within the array
Is this homework or something? Have a look to rule #6 on:
Simple rules of the UNIX.COM forums:
My intention was to give you some hints so try first to do it for yourself, then ask the forum.
Regards.