i'm new to shell can handle this script for me plz

Write a shell script named displayargs that prints FOUR lines. The first line tells the name that was used to invoke the script, the second line tells how many parameters there were, the third line tells what the last parameter was, and the fourth line tells what the first parameter was.
For example:

  $ display args  a b c
  My name is  displayargs.
  There were 3  parameters.
  The last one  was c.
  The first one  was a.

quick fix

first="$1"
let n=$#-1
shift $n
last="$1"

echo "
My name is $0
There were $# parameters
The last one was $last
The first one was $first
"

simpler :

echo "My name is $0"
echo "There were $# parameters"
echo "The last is ${!#}"
echo "The first is $1"

thank u but thats it?

What do you mean "that's it"? Of course that's it, you don't need any more code to display some command line arguments.

i'm confuse bcoz i got this output which is not the same output in the question

my name is ./displayargs
there were 0 parameteres
the last is ./displayargs
the first is

that's because you did not give any argument.
I'm sur you are able to modify the script so that it take care of that possibility. The syntax :

if ...
then ...
else ...
fi ...

oh i guess i'm lost...

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.