# Rake questions

**URL:** <https://www.ruby-forum.com/t/rake-questions/95485>\
**Category:** Ruby\
**Created:** [June 3, 2006, 1:05am UTC](https://www.ruby-forum.com/t/rake-questions/95485 "2006-06-03T01:05:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xmg-eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f04885/32.png) [@xmg-eric](https://www.ruby-forum.com/u/xmg-eric)\
**Post date:** [June 3, 2006, 1:05am UTC](https://www.ruby-forum.com/t/rake-questions/95485/1 "2006-06-03T01:05:23Z")

</div>

1. Is there some reason to prefer  
sh %{ls -ltr}  
over  
sh “ls -ltr”  
?

2. My standard csh idiom for creating a log  
file is this:  
ls |& tee test.log

3. A single quote (’) in a comment causes a parse  
error. Is this a known rake bug? If not,  
what’s the best way to report it?

thanks  
eric

---

<div class="post-metadata">

**Author:** ![xmg-eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f04885/32.png) [@xmg-eric](https://www.ruby-forum.com/u/xmg-eric)\
**Post date:** [June 3, 2006, 4:52am UTC](https://www.ruby-forum.com/t/rake-questions/95485/2 "2006-06-03T04:52:35Z")

</div>

Hi Eric,

I’m by no means a rake expert but since no-one else has answered;

On 6/3/06, Eric A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 1. Is there some reason to prefer  
> sh %{ls -ltr}  
> over  
> sh “ls -ltr”  
> ?

Perhaps so that you can do this;

```
sh %{grep "long long" *}

```

without having to escape the double quotes. Just a guess.

> ```
> Is there a Rakefile idiom for displaying
> execution results and also saving them
> in a file?
> 
> ```

I’d do this;

```
def tee(output, file_name)
  puts output
  File.open(file_name, "a") {|f| f << output }
end

task :default do
  tee `ls`, "out.log"
end

```

> 1. A single quote (') in a comment causes a parse  
> error. Is this a known rake bug? If not,  
> what’s the best way to report it?

I’m not sure exactly what you mean by this. Are you saying

```
# this is a comment with a quote '

```

causes a parse error? Anyway, I’m not sure where to report bugs to  
Rake but I’d probably try the devel mailing list;

```
http://rubyforge.org/mailman/listinfo/rake-devel

```

They should at least point you in the right direction.

---

<div class="post-metadata">

**Author:** ![xmg-eric](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/f04885/32.png) [@xmg-eric](https://www.ruby-forum.com/u/xmg-eric)\
**Post date:** [June 5, 2006, 11:24pm UTC](https://www.ruby-forum.com/t/rake-questions/95485/3 "2006-06-05T23:24:37Z")

</div>

David B. wrote:

> sh %{grep “long long” \*}
> 
> without having to escape the double quotes. Just a guess.

Darn good guess, as it turns out. I was just doing something  
similar using rsync in my Rakefile, and was glad I had  
encoded %{…} for that very reason.

> > ```
> > Is there a Rakefile idiom for displaying
> > 
> > ```
> 
> task :default do  
> tee `ls`, “out.log”  
> end

Doh! Of course. Thanks.

> [http://rubyforge.org/mailman/listinfo/rake-devel](http://rubyforge.org/mailman/listinfo/rake-devel)
> 
> They should at least point you in the right direction.

Another great tip. Thanks. I was at the Rake site, but  
missed that pointer somehow.
