7 kyu

Unix command line `ls -l` extract the file type.

389 of 816nbeck

Description:

On Unix system type files can be identified with the ls -l command which displays the type of the file in the first alphabetic letter of the file system permissions field. You can find more information about file type on Unix system on the wikipedia page.

  • '-' A regular file ==> file.
  • 'd' A directory ==> directory.
  • 'l' A symbolic link ==> symlink.
  • 'c' A character special file. It refers to a device that handles data as a stream of bytes (e.g: a terminal/modem) ==> character_file.
  • 'b' A block special file. It refers to a device that handles data in blocks (e.g: such as a hard drive or CD-ROM drive) ==> block_file.
  • 'p' a named pipe ==> pipe.
  • 's' a socket ==> socket.
  • 'D' a door ==> door.

In this kata you should complete a function that return the filetype as a string regarding the file_attribute given by the ls -l command.

For example if the function receive -rwxr-xr-x it should return file.

Strings
Regular Expressions
Fundamentals

Similar Kata:

Stats:

CreatedNov 9, 2016
PublishedNov 10, 2016
Warriors Trained1150
Total Skips6
Total Code Submissions1594
Total Times Completed816
Ruby Completions82
Crystal Completions13
JavaScript Completions318
CoffeeScript Completions13
Python Completions389
Haskell Completions70
Total Stars12
% of votes with a positive feedback rating82% of 210
Total "Very Satisfied" Votes148
Total "Somewhat Satisfied" Votes47
Total "Not Satisfied" Votes15
Total Rank Assessments8
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • nbeck Avatar
  • bkaes Avatar
  • user8476848 Avatar
  • kazk Avatar
  • hobovsky Avatar
  • Just4FunCoder Avatar
Ad