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"

2 Answers 2


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.


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .