0

Can anyone explain me why

VBB:~ me$ test="zut"; echo $test; echo $test > test2; echo "echo test " $test2

output is :

zut
echo test
VBB:~ me$ 

and not

zut
echo test zut
VBB:~ me$ 

2 Answers 2

3

Because echo $test > test2 writes the output to a file named test2.

this set of commands is does what you would expect:

test="zut"; echo $test; test2=$test; echo "echo test " $test2
Sign up to request clarification or add additional context in comments.

Comments

0

Addition to first answer you can assign the value in the file a variable.

echo "$var" ; var= more test2

So you can get string after you wrote to file test2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.