Q-1

Write a shell script in Unix that lists files from your current working directory
· By modification time when called with lm
· By access time when called with la.
By default, the script should show the listing of all the files in the current directory.

Q-2

Write a shell script which add the statement “#include <stdio.h>” at the beginning of all the C source files in the current working directory, containing printf or fprintf, if it doesn’t have it included.

Need to Submit this by this Weeknd Please Help

What have you tried so far?

While it is bad form to do your homework for you, here are some hints...

Regarding Q1

1)What bash commands generate the listings you need? Try typing man ls at the command prompt.
2)Read about the bash If then else constructs.

Regarding Q2

Learn about sed - try typing man sed at the command prompt.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.