storing passed arguments in separate variables -shell scripting
Posted
by
Nathan Pk
on Stack Overflow
See other posts from Stack Overflow
or by Nathan Pk
Published on 2012-12-13T22:47:58Z
Indexed on
2012/12/13
23:03 UTC
Read the original article
Hit count: 310
In my script "script.sh" , I want to store 1st and 2nd argument to some variable and rest to another separate variable. What command I must use to implement this task? Number of arguments that is passed to a script is random)
When I run the command in console
./script.sh abc def ghi jkl mn o p qrs xxx #It can have any number of arguments
In this case, I want my script to store "abc" and "def" in one variable. "ghi jkl mn o p qrs xxx" should be stored in another variable.
© Stack Overflow or respective owner