nealbo
11-06-2006, 06:38 AM
Hi, I'm trying to write a simple script that writes the output of ls to a file. I'm using:
#!/bin/sh
$ls >> text.txt
and I've tried
#!/bin/sh
$ls > text.txt
Both of these create the file text.txt but don't add ls into it. There are files in the directory, so thats not the problem.
When I echo ls:
echo "$ls"
I get a blank line echoed.
What am I doing wrong?
And I also tried having a space in between $ and ls - because I've seen it written that way on some tutorial websites, but that gives me an error.
#!/bin/sh
$ls >> text.txt
and I've tried
#!/bin/sh
$ls > text.txt
Both of these create the file text.txt but don't add ls into it. There are files in the directory, so thats not the problem.
When I echo ls:
echo "$ls"
I get a blank line echoed.
What am I doing wrong?
And I also tried having a space in between $ and ls - because I've seen it written that way on some tutorial websites, but that gives me an error.