Skip to content

Instantly share code, notes, and snippets.

@gturi
Created September 17, 2022 15:54
Show Gist options
  • Save gturi/4f544cb373ddb409ec6aca87c01c8211 to your computer and use it in GitHub Desktop.
Save gturi/4f544cb373ddb409ec6aca87c01c8211 to your computer and use it in GitHub Desktop.
open konsole and run script if it was not started from konsole session

Open konsole and run script if it was not started from konsole session

This does not alter the script behaviour when running it directly in konsole with /path/to/script.sh

#!/bin/bash

tty -s || exec konsole -e "$0" "$@"

# script logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment