Help with unix/linux project.

November 3, 2010 at 22:38:23
Specs: Windows XP
Have no idea what im doing and this project is due in a couple of days just looking for help..

i need to set up a script that will clear the screen, present the user with some enumerated choices, warn them if an invalid option is entered, and keep on cycling until they break it off.
-Evaluate the argument and terminate the script if invalid or incomplete options are entered.
Option 1: Presents the current date in International Format : 22-MAR-2010(dashes and caps)
Option 2: Show the contents of a user specified file if it exists; otherwise complain
Option 3 Compile a specified c++ program. It will produce a file called a.out. Redirect any errors & Build an executable. If successful rename the a.out to the name of the source file followed by .exe. Get conformation by the user if you are replacing an existing file.
Option 0 terminate the script.

so in option 2 i need to write a script that will ask to enter a file name and when they do it will display the content? no clue how to do that #1 i got its pretty easy and #3 is WOW. lol

See More: Help with unix/linux project.

November 3, 2010 at 23:07:59
What language?

Here's a bourne shell example for #2

read x
[ -f $x ] && cat $x || echo "File does not exist"

#3 is similar, except you need two conditionals, something like:

-IF file exists
--cc $file 2>&1 /dev/null
---IF return 1
----mv a.out $file.exe
---else complain
-else complain

Report •
Related Solutions

Ask Question