I wrote a script ~/_bin/bcg to call another script that uses gimp to re-size a random image from a directory and then write it back out to another file. My (toplevel) script then uses hsetroot to set the X background to this image.

The only problems is that as soon as I call the other guy's script with exec !/_bin/aura, my script stops.

  1. Is there a way to call programs and scripts without exec?
  2. Is there a way to prevent exec from guillotine-ing my script?

If I run things without exec I get:

execvp: No such file or directory

I assume this means that bash implicitly uses some program execvp to parse each line and that program cannot find (or will not execute) ~/_bin/aura.

I can enter each line at the terminal and get what I want. I just can't put it all in a script, but that's what I want.

What can I do?

if [ -f ~/.bcg.bmp ]
        rm ~/.bcg.bmp
~/_bin/aura "~/_wall";
hsetroot -center ~/.bcg.bmp

Normally when you invoke a command in a bash script, the shell waits until the command completes and then runs the next command. When you use exec, you're telling the shell to replace itself with the command it is about to run, i.e. there is no shell once the command starts. So when the command finishes, it is as if the original script finished as well. You must run your command without exec if you want the script to continue running after the command finishes.

execvp: No such file or directory doesn't look like a bash error message. It is probably coming from the aura script, which is trying to run something that can't be found in your search path.

| improve this answer | |
  • "No such file or directory" is bash, and is a perror from execvp. – Kalle Oct 23 '12 at 17:13

When you quote ~ it loses its special behavior, but you can use $HOME

#~/_bin/aura "~/_wall";
~/_bin/aura "$HOME/_wall";
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.