[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with open and rm

From: Ken Irving
Subject: Re: Problem with open and rm
Date: Wed, 16 Mar 2011 10:45:11 -0800
User-agent: Mutt/1.5.20 (2009-06-14)

On Wed, Mar 16, 2011 at 10:54:15AM +0000, Barrie Stott wrote:
> The script that follows is a cut down version of one that came from elsewhere.
> #!/bin/bash
> cp /tmp/x.html /tmp/$$.html
> ls /tmp/$$.html
> [ "$DISPLAY" ] && open /tmp/$$.html
> ls /tmp/$$.html
> rm -f /tmp/$$.html
> I'm on an Imac with OS X 10.6.6. If I run the script as it stands,
> the open tries to open /tmp/$$.html in a new tab in the Safari
> browser and fails with the message: No file exists at the address
> ?/tmp/13551.html?. The terminal output is the following pair of lines,
> which suggest that the file is still around after open failed:
> /tmp/13551.html
> /tmp/13551.html
> If I comment out the final 'rm' line and run it again, I get what
> I want displayed (and a similar pair of lines on the terminal) but
> unfortunately the temporary file is left lying around.
> My two questions are: 
> Why?

Assuming open doesn't somehow block, the script is probably working
and removing the file just after open is invoked.

> How can I change the script so that I can both view the file and have
> it removed?

Adding sleep 30 before rm ought to leave it around for a while.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]