03-24-2014
UNIX script coding HW question
i am trying to write a script code in unix that will:
1. The problem statement, all variables and given/known data:
display following menu to user:
(A) Add
(B) Subtract
(C) Multiply
(D) Divide
(E) Modulus
(F) Exponentiation
(G) Exit
Then ask user for choice (A-F). After taking users choice ask user for two numbers and
perform chosen operation on those two numbers. The program should keep asking
for choice / numbers unless user chooses ‘G’ for exit.
2. Relevant commands, code, scripts, algorithms:
3. The attempts at a solution (include all code and scripts):
i tried everything to write this code i couldnt
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number
school name: Senaca college, Toronto, Canada, Name of Professor: peter wheeler, and Course Number: Tech 154
Last edited by vbe; 03-25-2014 at 06:22 AM..
Reason: added template...
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am looking for some coding standards for Unix Shell Scripting. Can anyone help me out in this?
Regards,
Himanshu (3 Replies)
Discussion started by: himanshu_s
3 Replies
2. Shell Programming and Scripting
Given this one long stream of data (all one line):
<TransactionDetail><TransactionHeader><ErrorLogging>YES</ErrorLogging><HistoryLogging>YES</HistoryLogging><ErrorDetection>NO</ErrorD... (4 Replies)
Discussion started by: dfran1972
4 Replies
3. Shell Programming and Scripting
Is there any site on Coding Standard for Shell Scripting in UNIX.
Please help me know!!!!!
Thanks
Om (1 Reply)
Discussion started by: Omkumar
1 Replies
4. UNIX for Dummies Questions & Answers
Hi!
Suppose I am at a location xyz:/abc1/abc2/abc3
Is it possible to move to another location xyz:/mnl1/mnl2/mnl3
by some coding within a script? (5 Replies)
Discussion started by: udiptya
5 Replies
5. Solaris
I'm just starting a 'serious' coding in UNIX, so what I need is to run a C code on UNIX, What do I have to install (app) prior to coding/running the code and how do I compile that code?
can I write my c code in UNIX or I need to have a visual studio for this? (7 Replies)
Discussion started by: Peevish
7 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I have very little knowledge with unix and pmcmd. I need help with a issue.
I have to see whether a file has been dropped in a particular location/path. If the file dropped I have to check the last modified time, which should be greater than 8pmEST the prior day. If the file has been... (4 Replies)
Discussion started by: redwolves
4 Replies
7. Shell Programming and Scripting
I have a file f1.txt that contains string:
f1.txt
aaa
bbb
ccc
...
I want to write code to search that each string in file f2.txt(this file contains 1000+line codes).
file f2.txt
..
..
....aaa...xyz..
...
...
...ppp...
(dots . can be characters ot blank spaces)
If particular... (2 Replies)
Discussion started by: Sanchit
2 Replies
8. Shell Programming and Scripting
Unix script coding help?
i am trying to write a code that will display following menu to user:
(A) Add
(B) Subtract
(C) Multiply
(D) Divide
(E) Modulus
(F) Exponentiation
(G) Exit
Then ask user for choice (A-F). After taking users choice ask user for two numbers and
perform... (3 Replies)
Discussion started by: renegade755
3 Replies
9. UNIX for Dummies Questions & Answers
Good afternoon everyone,
I am very new to UNIX shell scripting and I am trying to understand the following code. I know what it does but I need to modify it so it will allow me to pass a file name as *FILENAME*
Thank for any guidance offered.
if ] ; then
match=`expr "$file" :... (2 Replies)
Discussion started by: Walter Barona
2 Replies
10. What is on Your Mind?
Hi,
as I mentioned in this thread(https://www.unix.com/shell-programming-and-scripting/280737-awk-function-return-permutations-n-items-out-m.html), a helpful coding style may improve overall value and support for people who come here and want to learn things the participants from unix.com have... (2 Replies)
Discussion started by: stomp
2 Replies
script(5) Files script(5)
NAME
script - Boot script
DESCRIPTION
The boot script describes how the Erlang runtime system is started. It contains instructions on which code to load and which processes and
applications to start.
The command erl -boot Name starts the system with a boot file called Name.boot , which is generated from the Name.script file, using sys-
tools:script2boot/1 .
The .script file is generated by systools from a .rel file and .app files.
FILE SYNTAX
The boot script is stored in a file with the extension .script
The file has the following syntax:
{script, {Name, Vsn},
[
{progress, loading},
{preLoaded, [Mod1, Mod2, ...]},
{path, [Dir1,"$ROOT/Dir",...]}.
{primLoad, [Mod1, Mod2, ...]},
...
{kernel_load_completed},
{progress, loaded},
{kernelProcess, Name, {Mod, Func, Args}},
...
{apply, {Mod, Func, Args}},
...
{progress, started}]}.
* Name = string() defines the name of the system.
* Vsn = string() defines the version of the system.
* {progress, Term} sets the "progress" of the initialization program. The function init:get_status() returns the current value of the
progress, which is {InternalStatus,Term} .
* {path, [Dir]} where Dir is a string. This argument sets the load path of the system to [Dir] . The load path used to load modules is
obtained from the initial load path, which is given in the script file, together with any path flags which were supplied in the command
line arguments. The command line arguments modify the path as follows:
* -pa Dir1 Dir2 ... DirN adds the directories Dir1, Dir2, ..., DirN to the front of the initial load path.
* -pz Dir1 Dir2 ... DirN adds the directories Dir1, Dir2, ..., DirN to the end of the initial load path.
* -path Dir1 Dir2 ... DirN defines a set of directories Dir1, Dir2, ..., DirN which replaces the search path given in the script file.
Directory names in the path are interpreted as follows:
* Directory names starting with / are assumed to be absolute path names.
* Directory names not starting with / are assumed to be relative the current working directory.
* The special $ROOT variable can only be used in the script, not as a command line argument. The given directory is relative the
Erlang installation directory.
* {primLoad, [Mod]} loads the modules [Mod] from the directories specified in Path . The script interpreter fetches the appropriate mod-
ule by calling the function erl_prim_loader:get_file(Mod) . A fatal error which terminates the system will occur if the module cannot
be located.
* {kernel_load_completed} indicates that all modules which must be loaded before any processes are started are loaded. In interactive
mode, all {primLoad,[Mod]} commands interpreted after this command are ignored, and these modules are loaded on demand. In embedded
mode, kernel_load_completed is ignored, and all modules are loaded during system start.
* {kernelProcess, Name, {Mod, Func, Args}} starts a "kernel process". The kernel process Name is started by evaluating apply(Mod, Func,
Args) which is expected to return {ok, Pid} or ignore . The init process monitors the behaviour of Pid and terminates the system if Pid
dies. Kernel processes are key components of the runtime system. Users do not normally add new kernel processes.
* {apply, {Mod, Func, Args}} . The init process simply evaluates apply(Mod, Func, Args) . The system terminates if this results in an
error. The boot procedure hangs if this function never returns.
Note:
In the interactive system the code loader provides demand driven code loading, but in the embedded system the code loader loads all the
code immediately. The same version of code is used in both cases. The code server calls init:get_argument(mode) to find out if it should
run in demand mode, or non-demand driven mode.
SEE ALSO
systools(3erl)
Ericsson AB sasl 2.1.9.3 script(5)