Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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 –  Parhs Sep 18 '11 at 14:44
    
i mean if i pass a parameter enclosed in quotes. –  Parhs Sep 18 '11 at 14:45
1  
That's because your shell strips them. –  Ignacio Vazquez-Abrams Sep 18 '11 at 14:47
    
the is no solution ? –  Parhs Sep 18 '11 at 15:20
    
you mean that they are not visible? –  Parhs Sep 18 '11 at 15:20

Your Answer

 
discard

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.