# Passing command line parameters as list

**URL:** <https://forums.eggplantsoftware.com/t/passing-command-line-parameters-as-list/1285>\
**Category:** Eggplant Functional\
**Created:** [February 28, 2006, 8:23pm UTC](https://forums.eggplantsoftware.com/t/passing-command-line-parameters-as-list/1285 "2006-02-28T20:23:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kool\_Friend](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/k/aeb1de/32.png) [@Kool\_Friend](https://forums.eggplantsoftware.com/u/Kool_Friend)\
**Post date:** [February 28, 2006, 8:23pm UTC](https://forums.eggplantsoftware.com/t/passing-command-line-parameters-as-list/1285/1 "2006-02-28T20:23:30Z")

</div>

Hi,

I have the following requirements:

In the command line executtion after -params option, I have to pass 2 parameters but each parameter could be a list:

parameter 1: (p11,p12)  
parameter 2: (p21,p22)

So I’m passing the parameters exactly as shown above. How do I save them as list in the main script using “params” command.

Possible soultion:

Main Script:

params cmd\_p1,cmd\_p2…

function f1 (cmd\_p1) // Will it pass the whole list (p11,p12)

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![bharathh](https://forums.eggplantsoftware.com/letter_avatar_proxy/v4/letter/b/b5e925/32.png) [@bharathh](https://forums.eggplantsoftware.com/u/bharathh)\
**Post date:** [March 1, 2006, 9:53am UTC](https://forums.eggplantsoftware.com/t/passing-command-line-parameters-as-list/1285/2 "2006-03-01T09:53:11Z")

</div>

I don’t know if you can send in a list, but a simple workaround for your problem may be to use files where you specify your list of params.

You can read your file from eggplant easily enough.

params.txt

```auto

p1, p2, p3
p4, p5, p1

```

---

<div class="post-metadata">

**Author:** ![SenseTalkDoug](https://forums.eggplantsoftware.com/user_avatar/forums.eggplantsoftware.com/sensetalkdoug/32/88_2.png) [@SenseTalkDoug](https://forums.eggplantsoftware.com/u/SenseTalkDoug)\
**Post date:** [March 1, 2006, 11:08am UTC](https://forums.eggplantsoftware.com/t/passing-command-line-parameters-as-list/1285/3 "2006-03-01T11:08:34Z")

</div>

When you call a script from the command line, parameters can only be passed as text strings (the shell doesn’t understand SenseTalk lists or property lists). So, to pass in a list safely, you’ll need to do a couple of things. First, quote the parameters on the command line, something like this:

```auto
/Applications/Eggplant.app/runscripts /path/to/your/script -params "(p11,p12)" "(p21,p22)"

```

Then, in your script, you can use the value function to turn these values into lists:

```auto
params firstParam, secondParam
set list1 to value(firstParam)
set list2 to value(secondParam)

```

If you have a lot of data you want to pass in, putting it in a file as bharathh suggested may be a better solution.
