Function

Hi,

There are two functions, both are returning value each.

1) get_num
2) confirm_num

Function 1 returns the backup copy number (numeric value)
Now, if the return value is not equal to 1 then it will call Function 2.

Function 2 will ask the user, if want to enter the number again, user will enter "y" or "n"

If the user enters "y" then again Function 1 should be called to insert the number again and if enters "n" then will proceed with the further code.

How it can be done?

With Regards

The backup copy number is always 1? Or is the first function

int isBackupNAvailable( int n )

?

What script language?

If you know enough to write functions, flow would seem trivial!

Hi,

Actually the Func1 is called first which will prompt for the user input to insert the backup copy number from the displayed list (in descending order---latest copy first)

Now, function will also perform a check for which number user has selected.

Now, if it is not 1 then user didnt selected the latest copy, so the Func2 will be called which will prompt the user again for the confirmation "y" or "no"
If user enters "y" code will execute further and if "n" then will again prompt for the number.

With Regards

zans=y

until [ $zans" = "n" ]
do
 function1()
 zret=$?

 if [ $zret = 1 ]
 then
  echo "This is not the latest, do you want to select another (y/n)? \c"
  read zans
 else
  zans=n
 fi

done
until [ "$zans" = "n" ]

@DGnitPick

Dude! You've lost one of you dear double quote ... if know you prefer the single one but still... do you have too many of them ? :wink:

It's amazing these old fingers, on a laptop keyboard occasionally like today, can type anything. Don"t quote me!

Hi

Thanks DGPickett

With Regards