Prerequisites
You should complete the "Unix-like Interface" module before starting this lab.
Overview
The goal of this lab exercise is to understand the CygWin environment: how to setup, invoke and exit the bash shell. A few CygWin tools are described and compared with those for Win32.
Exercise
Open a Windows 2003 command window: push the Start button on the left corner of your desktop, choose the Run... item from the menu, and type cmd in the text field. A text command windows should appear on your screen.
Check if the HOME environment variable is defined:
- set HOME
In case you can't see the
HOME environment variable type another command:
- set HOME=H:\Users\username
Note: "username" should be your regular login ID.
Check if main Cygwin utilities directory are in your path by typing the Win2K command:
- path
If you can't see
C:\Cygwin\bin; in your
PATH variable, run another command:
- call setup_cygwin.bat
Run the commands "bash" and "bash --login". Check how the command prompt and path differ:
- env | grep -i path
Type the
"exit" command to return to the Win2K command prompt.
Make sure you are in the bash shell. Locate the "df.exe" utility using
"type" or
"which" commands:
- type -a df
which -a df
If the Compaq compiler
"df.exe" precedes the Cygwin
"df.exe", type
"/bin/df", otherwise a simple
"df" will show you the disk free information (and mount points for the Win2K directories).
Download and save the file temp_dir.tar.gz in your home directory H:\Users\username. Unzip and untar the file:
- gunzip temp_dir.tar.gz
tar -xvf temp_dir.tar
which will create a directory
temp_dir in your home directory. Make this directory current:
- cd ./temp_dir
Check the full name and the total length (kBt):
- pwd
du -k .
The subdirectory
sources contains a small F90 project. Run the script to find all the programs, subroutines and function items:
- ./infof90.sh
The similar can be obtained by running a perl script:
- perl ./plinfo.pl
You can easily compile the project using the make utility. Change the current directory to the "sources", and run the "make" command:
- cd ./sources
Solution
Run the program "progmain.exe", and you'll see the results:
./progmain.exe
Cleanup
At the end of this small exercise go to your home directory and clean out the created files and directories:
cd /cygdrive/h/Users/username
rm temp_dir.tar
rm -R -f temp_dir