Joining string arguments

Hi,

how can I join given arguments (not starting from the first one) to form one string, each argument separated by a space. For example, out of 5 given arguments, I'll like to start joining from the 3rd to the last. In python there exists something like ' '.join(sys.argv[3:]) and it starts joining from the 3rd argument to the last, each separated by a space. I looked for something similar to "join()" but couldn't find one, so I decided to write a script which joins the arguments.
My script looks like this:

#!/bin/bash

result=""
for ((  i = 3 ;  i <= $#;  i++  ))
do
    result=$result" \$$i"
done
echo $result

And the result I get using 4 arguments is:

$3 $4

Could someone please help me ?
Thanks.

The only way I could think of was using evil eval:

#!/bin/bash

result=""
for ((  i = 3 ;  i <= $#;  i++  ))
do
    result=$result" "$( eval "echo \${$i}" )
done
echo $result

Be careful, because any errors inside the eval aren't caught at parse time, but show up during run time, which can lead to bad things when you don't expect them.

Hey,

this is great, it works. I think I have to read more on "eval".
Thanks for the prompt reply.

#!/bin/bash
params="$@"
echo ${params#* * }

---------- Post updated at 06:58 AM ---------- Previous update was at 06:55 AM ----------

#!/bin/bash
shift;shift
echo "$@"
#!/bin/bash

shift 2
echo "$@"

or

#!/bin/bash
shift 2
for var in "$@"
do
  result=$result" "$var
done

echo $result

Woops sorry, as has been pointed out should be shift 2 not 3. I must make a note to read the posts before replying to them in future.... :wink:

Wow,
the code is getting better and better.
I'm just soo happy.

Thanks to you all.