Saturday, April 27, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 422  / 2 Years ago, sun, january 23, 2022, 12:52:10
gnome-terminal --tab -e "
sh -c '
gedit'/media/ubuntuman/Onces And for Al/scripts/faceBook' & ;
sudo cpulimit -e ubuntu-tweak -l 80;'"


This is the piece of code I want to edit. The special character ' (single quote) in of sh -c will conflict with the single quote of gedit, how can I solve it?



I also find that if I run the first job in the background, the terminal doesn't execute the second job of sudo cpulimit bla bla ... Why?


More From » command-line

 Answers
7

Please try the following command, it should start both jobs:



gnome-terminal --tab -e "
sh -c '
(gedit /media/ubuntuman/Onces And for Al/scripts/faceBook &) ;
sudo cpulimit -e ubuntu-tweak -l 80;'"


Parentheses denote a subshell in bash. To quote the man page:



   (list) list is executed in a subshell environment (see  COMMAND  EXECU‐
TION ENVIRONMENT below). Variable assignments and builtin com‐
mands that affect the shell's environment do not remain in
effect after the command completes. The return status is the
exit status of list.

[#23195] Monday, January 24, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tresein

Total Points: 197
Total Questions: 113
Total Answers: 112

Location: Hungary
Member since Wed, Nov 9, 2022
1 Year ago
;