Trying to run a script in a new terminal tab from a running script

I'm kind of confused, I thought doing something like this would work :

#!/bin/bash
wget
chmod +x myscript.sh
exec gnome-terminal --tab --active --title="my title" -- myscript.sh

But running this returns :

error message in terminal

There was an error creating the child process for this terminal

Failed to execute child process "myscript.sh" (No such file or directory)

Removing exec doesn't work I also tried putting the file name in between $( ) and " ", I also tried putting the absolute path.

What am I doing wrong?

1

1 Answer

The correct syntax is :

gnome-terminal --tab --active --title="my title" -- "/tmp/myworkdir/myscript.sh"

having an absolute path will allow for the file to be run.

make sure to makes all your file operations happen in this same directory.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like