Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.
#!/bin/bash

aa=$( ps -e   | grep "chrome" | awk '{print $1;}')
for i in $aa
   do
     gnome-terminal --tab -e" sudo cpulimit -p $i -l 35 " 
   done

when i run it i get error missing argument e i want it when a chrome process get run to get all process related parent and children and safe them in aa variable then i open the gnome terminal to cpulimit one by one , any help pls ?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

The error should give you a hint: Just add a space after -e.

share|improve this answer
    
there ıs no hınt just as ı mentıoned sır and ı already put * thank u for replyıng :) Failed to parse arguments: Missing argument for -e –  Ahmed Zain El Dein Apr 29 '13 at 19:17
1  
@AhmedZainElDein: You probably misunderstood me. Put a space between -e and "sudo cpulimit .... –  choroba Apr 29 '13 at 19:49
    
yes sir u are right thank u btw i want to ask about final thing i want to open the gnome all taped in one window for every loop not to open gnome window in each iteration so can u help me in this –  Ahmed Zain El Dein Apr 29 '13 at 20:00

pgrep is a handy tool to extract PIDs based on a program name:

pgrep chrome | 
while read pid; do
  gksudo cpulimit -p $pid -l 35
done
share|improve this answer
    
thank u sir for replying but i want to save it in variable aa= $somevalue to do more further things later using this variable –  Ahmed Zain El Dein Apr 29 '13 at 19:21
    
and i want to make inside the for loop to open gnome terminal and also in each iteration make the open gnome terminal to be tap not in each loop open new independent terminal windows –  Ahmed Zain El Dein Apr 29 '13 at 19:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.