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

Re: error "sh: 1: exec: ...: File exists" with dash



On 2016-03-03 11:06:55 +0100, tomas@tuxteam.de wrote:
> On Thu, Mar 03, 2016 at 10:18:55AM +0100, Vincent Lefevre wrote:
> > I've got the following error in a script yesterday on a Debian 8
> > machine:
> > 
> >   sh: 1: exec: /home/vlefevre/bin/mymaple: File exists
> > 
> > where sh is dash. The command that led to this error is equivalent to:
> 
> Just a cheap shot (I see you've dug up a couple of things which
> might make my hunch obsolete). Do you have perhaps the noclobber
> option set?

It is in my zsh shell, but here zsh is not involved at all.
For dash, it is not set by default:

francine:~> sh -c 'touch moo; echo blah > moo'
francine:~>

Anyway, I don't see why the noclobber option would have any effect
on the exec command, even when there is a redirection to a file:

francine:~> sh -c 'set -C; touch moo; exec true > moo'
sh: 1: cannot create moo: File exists

As you can see the error message is different. It is at the shell
level (before the "exec" command gets executed).

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


Reply to: