Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
Failed to parse arguments: Argument to "--command/-e" is not a valid command: Text ended before matching quote was found for ". (The text was '"cpulimit')

this is what i get when i run the following script in terminal

read -p "Which program u want to limit its processes?" ProgrameName
read -p "Which limitation percentage u want for it ?" limitationPercentage  

getAllPIDRunUnderThisProgram=$( ps -e | grep "$ProgrameName" | awk '{print $1;}')
for i in $getAllPIDRunUnderThisProgram
    gnomeTab+="  --tab -e \"cpulimit -p $i -l $limitationPercentage \" "  

gnome-terminal $gnomeTab

he cant parse the escape character "\" which it has to be used because of the double quote in line 8 gnomeTab+=" --tab -e \"cpulimit -p $i -l $limitationPercentage \" ",so is there a solution to use the double quote as they are mandatory to be used after --tab -e " some commands " and not to get the problem of parsing ?

share|improve this question
up vote 3 down vote accepted

You can change the very first line to

#!/bin/bash -xv

to make the shell show you how it interprets arguments.

Rather than escaping (which leads to eval), you should use arrays to accumulate options:

for i in $getAllPIDRunUnderThisProgram ; do
    gnomeTab+=(--tab -e "cpulimit -p $i -l $limitationPercentage")  

echo "${gnomeTab[@]}"
share|improve this answer

Your Answer


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.