Monday, April 29, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 31689  / 2 Years ago, sun, september 18, 2022, 4:27:53

How to write Bash script to open a terminal with two tabs, and execute commands in both tabs?



for instance:

tab 1 opens skype

tab 2 opens chromium-browser



In the end, I want one more thing: write a bash script with my skype username and password and feed those to skype.



Thanks


More From » bash

 Answers
6

one terminal with two tabs:



gnome-terminal --tab --tab


use the -e switch to execute commands (or scripts):



gnome-terminal --tab -e "command1" --tab -e "command2"


(I don't think there is an easy way of feeding your credentials to skype via the terminal.)

Update: check w4YGcbTeIH's answer, skype allows giving credentials via the command line.



But beware, your credentials would be exposed and this should be avoided.



A script to open skype and chromium-browser would look like the following:



#!/bin/bash

skype --dbpath=<path> &
chromium-browser &


Put this code into myscript.sh and execute chmod +x myscript.sh (in a terminal) to make it executable.



About skype:




  • you can run skype without arguments (skype &) and it will load your default user profile ~/.Skype.

  • run it with --dbpath=<path> where <path> is your actual path of the Skype profile you want skype to load.



To run the script do one of the following:




  • open a terminal and execute ./myscript.sh

  • double click on the script and choose Run in the dialog.


[#34835] Monday, September 19, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cocal

Total Points: 236
Total Questions: 111
Total Answers: 123

Location: Belarus
Member since Tue, Mar 14, 2023
1 Year ago
cocal questions
Tue, Oct 12, 21, 20:46, 3 Years ago
Sat, Oct 8, 22, 04:23, 2 Years ago
Wed, Sep 14, 22, 22:38, 2 Years ago
Sun, Dec 18, 22, 02:24, 1 Year ago
Wed, Jun 29, 22, 17:31, 2 Years ago
;