Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write and compile some programs to accomplish the standard Unix commands in Hask

ID: 3777862 • Letter: W

Question

Write and compile some programs to accomplish the standard Unix commands in Haskell. You may find the documentation for the following libraries helpful:  System.Directory, System.IO.

"cp" - (copy file) - which takes a from and to arguments.

"pwd" - (print working directory) prints the name of the current directory

"ls" - (list) which lists the names of files in the current directory. Like "dir" on windows.

"cat" - (concatenate files) takes a filename and outputs it's contents to standard output.

Explanation / Answer

1) cp-copy

program:-

in unix:- cp source_file_name destination_file_name;

in haskell:-

2)pwd:-

in unix:-   pwd ;

in haskell:- // cmd that simply displays the current working directory

3) ls :- list of files

in unix:- ls;

in haskell:-

  

4) cat:- concatenate a file

in unix:- cat> a; // opens a file named "a" for writing or displays "a"'s content if any

in haskell:- main = putStrLn "hello world"

how to save compile and run the haskell program: -

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote