Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have made a script
ocrun param1 param2
that calls another program like
oprun param1 ..

i would like somehow param3 and all following (parami) to be copied to oprun.. ex:

 `ocrun param1 param2 param3 param4   

`oprun param1` param3 param4   

How can i achieve this ?

share|improve this question
up vote 3 down vote accepted

Slice the argument array ($@).

oprun "$1" "${@:3}"
share|improve this answer
hm this works nicely, but "test string" the quotes are missing in the result – GorillaApe Sep 18 '11 at 14:44
i mean if i pass a parameter enclosed in quotes. – GorillaApe Sep 18 '11 at 14:45
That's because your shell strips them. – Ignacio Vazquez-Abrams Sep 18 '11 at 14:47
the is no solution ? – GorillaApe Sep 18 '11 at 15:20
you mean that they are not visible? – GorillaApe Sep 18 '11 at 15:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.