The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 04-29-2008
grial's Avatar
grial grial is offline Forum Advisor  
El UNIX es como un toro
  
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
Quote:
Originally Posted by sam4now View Post
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.

Last edited by grial; 04-29-2008 at 06:17 AM..