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

I am very new to the Linux environment, and I am stuck with a situation. What I want to do is to pass the command test -s $testFile to a variable, like, say "tes"

tes="test -s $testFile"
share|improve this question
up vote 6 down vote accepted

If the command you're trying returns specific data, you could use:

test = "$(test -s $testFile)"

When you use $(), you're telling the command line to execute the function passed in a subshell, get the result and print back on the other terminal.

share|improve this answer

Try this:

echo [string you want to output].
echo [object that may or may not turn into a string].

Careful with the '$', as noted above.

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.