call function with different parameters position

Hi

I would like to call function in my script couple of times. But each time with different parameters position.
In line 57 I don't know how to call it without typing $1 and $ parameters ?

 #!/bin/ksh
     2
     3
     4  function First
     5  {
     6
     7  # $1 - name
     8  # $2 - second name
     9  # $3 - age
    10  # $4 - sex
    11
    12          typeset -r MY_NAME=$1
    13          typeset -r MY_2nd_NAME=$2
    14          typeset -ri AGE=$3
    15          typeset -r SEX=$4
    16
    17
    18  if [[ -n $MY_NAME && -n $MY_2nd_NAME ]]       
    19  then
    20
    21          print -n "Name is: $MY_NAME in function locally"
    22          print
    23
    24          print -n "Second name is: $MY_2nd_NAME in function locally"
    25          print
    26  else
    27          print "My age is: $AGE"
    28          print
    29          
    30          print "My sex is: $SEX"
    31          print
    32  fi
    33  }
    34
    35
    36
    37
    38  # Start of the program
    39
    40  print -n "Podaj imie: "
    41  read NAME
    42  print
    43
    44  print -n "Podaj nazwisko: "  
    45  read nd_NAME 
    46  print
    47
    48
    49  print "Running local funtion First"
    50  First $NAME $nd_NAME    
    51  print
    52
    53
    54 print "Calling function First again, but now with other parameters"
    55  print
    56
    57  First $1 $2 29 male

thx for help

You use probably script in below

./myscript Name Surname

and print this information..
so what do you want exactly?

you can call script also this like without pos parameters

First Name Surname 29 male

and script

./myscript

I want to call function First() with its positional parameters $1 $2 and so on but don't want those parameters to be positional parameters from script file.

Don't know how to substitute $1, $2 when I call this function, cause I want to only call this First() with parameters $3 and $4.

---------- Post updated at 11:23 PM ---------- Previous update was at 11:17 PM ----------

I got it :slight_smile:
Solution in line 57.
I just have called the function and paste in positional parameters $1 and $2 no values at all.

    57  First "" "" "29" "male"