# Execute command inside while problem

**URL:** <https://community.unix.com/t/execute-command-inside-while-problem/234807>\
**Category:** Shell Programming and Scripting\
**Created:** [March 11, 2009, 4:31am UTC](https://community.unix.com/t/execute-command-inside-while-problem/234807 "2009-03-11T04:31:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ruben.rodrigues](https://community.unix.com/letter_avatar/ruben.rodrigues/32/5_5575768a8748004e209b776fc1b2916d.png) [@ruben.rodrigues](https://community.unix.com/u/ruben.rodrigues)\
**Post date:** [March 11, 2009, 4:31am UTC](https://community.unix.com/t/execute-command-inside-while-problem/234807/1 "2009-03-11T04:31:45Z")

</div>

Hi!

How can I execute a linux command inside the while cicle??

like:

> [@](#):
>
> while [svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &\> $LOGFILE] ; do  
> ...  
> ...  
> done

This doesn't work. Should I replace the by '' or ""

---

<div class="post-metadata">

**Author:** ![Franklin52](https://community.unix.com/user_avatar/community.unix.com/franklin52/32/500_2.png) [@Franklin52](https://community.unix.com/u/Franklin52)\
**Post date:** [March 11, 2009, 1:45pm UTC](https://community.unix.com/t/execute-command-inside-while-problem/234807/2 "2009-03-11T13:45:44Z")

</div>

There must be a space after the open square bracket '[' and a space before the close square bracket ']'

```nohighlight
while [svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &> $LOGFILE] ; do

```

instead of:

```nohighlight
while [svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &> $LOGFILE] ; do

```

Regards

---

<div class="post-metadata">

**Author:** ![cfajohnson](https://community.unix.com/user_avatar/community.unix.com/cfajohnson/32/16669_2.png) [@cfajohnson](https://community.unix.com/u/cfajohnson)\
**Post date:** [March 11, 2009, 7:24pm UTC](https://community.unix.com/t/execute-command-inside-while-problem/234807/3 "2009-03-11T19:24:16Z")

</div>

> [@ruben.rodrigues](#):
>
> Hi!
> 
> How can I execute a linux command inside the while cicle??
> 
> like:
> 
> ```plaintext
> while [svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &> $LOGFILE] ; do
> ...
> ...
> done 
> 
> ```
> 
> This doesn't work. Should I replace the by '' or ""

```plaintext
while svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &> $LOGFILE ; do
...
...
done 

```

---

<div class="post-metadata">

**Author:** ![cfajohnson](https://community.unix.com/user_avatar/community.unix.com/cfajohnson/32/16669_2.png) [@cfajohnson](https://community.unix.com/u/cfajohnson)\
**Post date:** [March 11, 2009, 7:44pm UTC](https://community.unix.com/t/execute-command-inside-while-problem/234807/4 "2009-03-11T19:44:46Z")

</div>

> [@franklin52](#):
>
> There must be a space after the open square bracket '[' and a space before the close square bracket ']'
> 
> ```plaintext
> while [svn checkout svn+ssh://ruben@192.168.1.3/esp-server/svn/$URL &> $LOGFILE] ;
> do
> 
> ```
> 
> instead of:

That doesn't execute svn; test (a.k.a. [) sees it as its first argument, and expects the second argument to be an operator.
