Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 513  / 3 Years ago, sat, june 12, 2021, 11:45:20
#!/bin/bash
gnome-terminal --command='/home/user23/bin/n-youtube-dl "$1"'


I want to pass the argument passed to this script to the other script started in the terminal. But this starts endless gnome terminals.



Can you explain why that is and how to make this work?



I am running zsh has my main shell if that matters, the terminal starts the script in zsh then I guess.



Update:



#!/bin/bash
gnome-terminal --command='echo "WTF"'
read -p "Press [Enter] key"


Is just closing the term faster then I can see WTF. Isn't it supposed to stop? Same goes for replacing the WTF with $1 again, no respawn.


More From » bash

 Answers
6

To run a command in gnome-terminal, and safely pass arguments to it, you should use the -x option, since this avoids having the line parsed by two shells.



#!/usr/bin/env bash
gnome-terminal -x youtube-dl "$@"

[#26053] Monday, June 14, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
arsleyeuth

Total Points: 72
Total Questions: 121
Total Answers: 112

Location: North Korea
Member since Mon, Oct 31, 2022
2 Years ago
;