Domanda

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 .*
È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top