need help asap!

Hello everyone, I'm new to using Linux and i am trying to create a script that will produce a list of all the files of the present working directory. So far I only have this

#!/bin/bash
cd /
ls -lt>>

I can't figure out what I am suppose to do next.

Your script doesn't list the current directory; it lists the root directory.

All you need is one line:

printf "%s\n" *

all i need is this one line? or did i do something wrong to start off with?

Since the shell expands wildcards, that is all you need.

You changed directory (to the root directory), which meant that anything you did later applied only to that directory (unless you did another cd later). Since you want to list files in "present working directory", there is no sense to changing directory.

ok so i screwed up on my quest of fame. my orginal intentions were to do the following:

Create a script that will produce a text file that has a list of the files in the present working directory. Ensuring that I use the proper syntax to allow auto-execution from the command prompt. So far I have all is the first script that I orginally had. If I wanted to place internal comments I will have to do this line first right?

###comment place here (I am going to use my name and maybe a script title, explaining what this script was intended to do and such)

#!/bin bash/ >>
pwd / >>
ls -lt
printf

#!/bin/sh
printf "%s\n" * > FILENAME

Or:

#!/bin/sh
ls -lt > FILENAME

All you need for that is to make the script executable with

chmod +x /path/to/script

.

You can put comments anywhere.

Please put code inside [code] tags.

Why do you have >>? It is for output redirection, and you have not specified where the output is to go.

Again, why do you have >>?

And why are you using pwd? It just prints the current directory. And why do you have an argument after it? It doesn't take any arguments.

What's the printf for?

Is this homework?