Question

I'm learning KSH at the momment and wondering....if you used the command:

ls .* it would display all files in that current directory including any other directories.

what if I wanted to display all the items in another directory? How would I accomplish this.

This is what I used firstly:

#!/bin/ksh

echo "Files in Folder:"
ls .*
Was it helpful?

Solution

No, ls .* will only list the hidden files and directories which by convention start with a dot. This will include .., which will actually be listing the files in the parent directory. You can just use ls or ls *. If you want to list the contents of another directory, use ls $1 and call the script like so: script.ksh /tmp

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top