When doing
echo "some stuff" >> file.txt
I can append to my file some stuff
But when trying to do
echo ls >> file.txt
I append ls instead of listing all my items in the current path. How can I fix this? Sorry I'm new to linux
CodePudding user response:
just redirect the ls output
ls >> file.txt
CodePudding user response:
echo ls >> file.txt
This is interpreted as echo the term ls to file.txt. This isn't what you want.
>> redirects the output of a command, which can be ls.
So you could do:
ls >> file.txt
