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.

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"
Example:

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

 
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.