user1577775
user1577775

Reputation: 59

Start New Terminal with Bash Script

I am trying to create a BASH script that will first open a new terminal, then run the rest of the script in that new terminal. If possible I would like this to be in one complete script.

I do not want konsole -e as this would require me making a seperate script ( I think)

Upvotes: 1

Views: 4639

Answers (2)

Abhishek
Abhishek

Reputation: 882

I think you can try this:

#!/bin/bash
echo "<your script/*eg. ./bashfile.ext*/>" | xterm

Upvotes: 0

okobaka
okobaka

Reputation: 616

what have you tried - that was great

It is not that complicated to do:

#!/bin/bash
[ ! -f /tmp/$(basename $0) ] && cp $0 /tmp/ && konsole -e $0 && exit
rm /tmp/$(basename $0)
   # --- put your code here --- #

     echo "TESTING"

   # --- put your code here --- #

sleep 3s

What it does, it copy script to /tmp directory and run konsole -e over source script, removes temporary file, check if file does not exists and after execution of your code, sleeps 3 seconds then exits.

You could even mod /tmp/ script and run over it.

Upvotes: 2

Related Questions