hercules[25]% script hello.log
Script started, file is hello.log
Script on hercules[1]% whoami
temp1
Script on hercules[2]%pwd
/home/hercules/t/temp1
Script on hercules[3]%ls
Script on hercules[4]%cat hello.cpp
#include <iostream>
using namespace std;
int main() {
string user_name;
cout << "Welcome to the world of C++" << endl;
cout << "What is your name? ";
cin >> user_name;
cout << endl;
cout << "Hi " + user_name + "! Welcome to CS110 class." << endl;
return 0;
} // end main
Script on hercules[5]% CC hello.cpp -o hello
Script on hercules[6]% hello
Welcome to the world of C++
What is your name? Ada
Hi Ada! Welcome to CS110 class.
Script on hercules[7]% exit
exit
Script done, file is hello.log
hercules[6]%
hercules[6]%
At the end of script process, the exit command is used to close the process of script. Always remember this --- WHEN YOU USE script YOU MUST ENTER exit AT THE END!!! In this example, hello.cpp is the C++ source file, hello is the executable file, and hello.log is the output from the Script. The printout for the C++ source code and the Script output will be required for your class assignment.
Once you are done your script, take a look at your hello.log
file. This file has all the requirement for handing in your assignment.You will see the
file has time stamp on it.
Copyright: Department of Computer Science, University of Regina.