# Pass args to command

**URL:** <https://forum.xojo.com/t/pass-args-to-command/34326>\
**Category:** Getting Started\
**Created:** [November 4, 2016, 10:13am UTC](https://forum.xojo.com/t/pass-args-to-command/34326 "2016-11-04T10:13:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marco\_Winster](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/f05b48/32.png) [@Marco\_Winster](https://forum.xojo.com/u/Marco_Winster)\
**Post date:** [November 4, 2016, 10:13am UTC](https://forum.xojo.com/t/pass-args-to-command/34326/1 "2016-11-04T10:13:47Z")

</div>

Hello,  
i have a simple bash script (on Mac)

#!/bin/bash  
ssh $1@$2

saved as myscript.command

if i use this in terminal: /Users/mw/myscript.command admin 10.0.0.68  
it works

now i want to use xojo to open that script in terminal and pass the two arguments to that script.

but this doesn’t work:

dim s as shell  
dim f as FolderItem=GetFolderItem("/Users/mw/myscript.command")

s.Execute f.ShellPath +" admin 192.168.3.40"

Note: “ssh” is just an example, i just wanted to know how this could work to open the terminal app, pass args and execute a script.

or Simple: how do i execute shell commands to run in terminal.app?

Thanks Marco

---

<div class="post-metadata">

**Author:** ![Axel\_Schneider](https://forum.xojo.com/user_avatar/forum.xojo.com/axel_schneider/32/465_2.png) [@Axel\_Schneider](https://forum.xojo.com/u/Axel_Schneider)\
**Post date:** [November 4, 2016, 10:47am UTC](https://forum.xojo.com/t/pass-args-to-command/34326/2 "2016-11-04T10:47:48Z")

</div>

why not

`
dim s as shell
s.execute("ssh $1@$2")`

it is better to use the full path in shell  
find out with

```auto
command -v ssh
```

---

<div class="post-metadata">

**Author:** ![Marco\_Winster](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/f05b48/32.png) [@Marco\_Winster](https://forum.xojo.com/u/Marco_Winster)\
**Post date:** [November 4, 2016, 11:00am UTC](https://forum.xojo.com/t/pass-args-to-command/34326/3 "2016-11-04T11:00:53Z")

</div>

thanks, but that doesn’t open the console (terminal.app), that just executes the ssh command…

---

<div class="post-metadata">

**Author:** ![Beatrix\_Willius](https://forum.xojo.com/user_avatar/forum.xojo.com/beatrix_willius/32/282_2.png) [@Beatrix\_Willius](https://forum.xojo.com/u/Beatrix_Willius)\
**Post date:** [November 4, 2016, 11:34am UTC](https://forum.xojo.com/t/pass-args-to-command/34326/4 "2016-11-04T11:34:22Z")

</div>

Why do you want to open the Terminal? Is the Terminal AppleScriptable? Then what you want to do might work.

---

<div class="post-metadata">

**Author:** ![Marco\_Winster](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/f05b48/32.png) [@Marco\_Winster](https://forum.xojo.com/u/Marco_Winster)\
**Post date:** [November 4, 2016, 11:52am UTC](https://forum.xojo.com/t/pass-args-to-command/34326/5 "2016-11-04T11:52:41Z")

</div>

got it:

dim s as new shell  
s.Execute(“osascript -e ‘tell application ““Terminal””’ -e Activate -e ‘do script "“ssh [admin@192.168.3.40](mailto:admin@192.168.3.40)"”’ -e ‘end tell’”)

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:32pm UTC](https://forum.xojo.com/t/pass-args-to-command/34326/6 "2020-10-29T18:32:34Z")

</div>


