Jump to content

Unix/ls: Difference between revisions

Line 1,307:
cheating solution:
{{works with|Smalltalk/X}}
<lang smalltalk>TranscriptStdout showCRprintCR: ( PipeStream outputFromCommand:'ls' )</lang>
real solution:
{{works with|Smalltalk/X}}
<lang smalltalk>TranscriptStdout showCRprintCR:('.' asFilename directoryContents sort asStringWith:Character cr)</lang>or:<lang smalltalk>'.' asFilename directoryContents sort do:#printCR
</lang>
full 'ls -l' output:
{{works with|Smalltalk/X}}
<lang smalltalk>dir := '.' asFilename.
dir directoryContentsAsFilenames sort do:[:fn |
|line|
"/ generate a line of the form (loke ls -l):
"/ drwxrwxrwx user group size date time name
Line 1,341 ⟶ 1,343:
s nextPutAll:fn baseName
].
Transcript showCR:line printCR
].</lang>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.