1. Write a Linux shell script to perform the following tasks:
a. Display current date and time
b. Display current working directory
c. To check whether a sample file is a directory
d. Display details of all files/directories in current working directory
e. To check whether a sample file is readable, writable, and executable.
Provide the shell script along with the sample output screenshot. Refer to the attached rubrics as a guide. Print a copy of the rubrics to be attached with this lab report.
int main()
{
time_t seconds = time(NULL);
tm* timeinfo = localtime(&seconds);
cout << "Current Datetime:" << asctime(timeinfo) << endl;
char path[MAX_PATH];
GetCurrentDirectory(sizeof(path), path);
string path_in_string = path;
cout << "Current Directory: " << path_in_string.c_str() << endl;
}
Comments
Leave a comment