Take the 2-minute tour ×

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer


