Solved

Multiple argument scripts .....

Posted on 1997-10-09
6
249 Views
Last Modified: 2010-04-21
hi there guys:
---------------
i want to know how to write a script where i have to give multple arguments that are not at start up :
for example if i want to write a script for c-shell to operate emacs its simple i write : (c-shell "emacs") /or creates a file opening emacs and just calling the prog.
but i f i want to use the "wall" option or the "write" option ... how do i do it?
to operate the wall i write : (c-shell "wall")
and than i must press enter and than to write the data and at the end ^d (ctrl+d) .
here i'm stuck ,please help me how do i do it.
0
Comment
Question by:doron123
  • 3
  • 3
6 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 2007220
either write your data (all the text excluding the ^d) into a seperate file and then call your script as follows:

    script <data_file

or you may use in your script, something like:

    cat <<'EndOfText' | your_desired_command
here comes your text
and so on ..
EndOfText

The literal `EndOfText' **must** not appear as first word in your text, 'cause it terminates your text. If you want to use wildcards and (shell)variable substitution in your text use the literal  `EndOfText'  without the quotes.
0
 

Author Comment

by:doron123
ID: 2007221
Thanks it works!!!! .
one thing more on this issue ..
when i write ^d or EndOfFile ,its shown on the screen and then! it terminates .. is there any option to not show it ..
like in dos @<argument> ,and then your command is not written?

is there any tool that can compile a script to run (like exe or com file so that not anyone can see its contant?

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2007222
If you use my 1'st solution (script <data_file), the data_file does not contain  EndOfText  nor  ^d.
((-: UNIX knows where a file ends: when there are no more chars :-))
So these should not be seen on the screen.

If you use my 2'nd solution, you must redirect stdout and/or stderr, this gets tricky for this example.

compile? Of cource: write it in any language of your desire (ada, C, C++, COBOL, FORTRAN, PASCAL, ...) and compile it.
There's no way to compile a script. The only solution I know is to crypt the script anyhow and use a wrapper which decrypt's it and then executes; any language solution would be more efficient.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:doron123
ID: 2007223
last thing .. i run a program of "Ami" ,which is long and does a lot of things that takes time ,i want to write each proccess that ends sends a remark (for it endividualy).... so the file solution is complicated .. isn't there any other solution to write the "Wall" and "write" without the file but to enter them with the same line ... like "write doron-a <text> "???

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 2007224
"Ami"? I don't know that.

I've not understood what you want to do exactly, need to know the context.
Give me some more info (may be your current script).
I'm shure that I find  a solution and then charge you for the points :-)
0
 

Author Comment

by:doron123
ID: 2007225
ok ...
it goes :
(in-pack "access")
(map "netlist name")
<here i want at the end of this proccess to write")
(c-shell "write <username> <text>")
i.e
(c-shell "write doron-a mapping stage finished")

there are alot of proccessed like here ,and i can't write a global scritp for this cause ,since each project is in an other directories ,and if i want to send it to the company than i don't want them to have too many files (it won't work) ,i want to write as in the example here in one line the content ,or if no other choise ,is there an option of having one file and telling in the script to write each time only some line that i will choose (i.e (c-shell "write doron-a line2>file_name")
meaning having one file with all the lines i want and telling in the script each time what line to write .

p.s.
-----
the script i sent you two lines from the first one is meaningless to you the secong is the begining of a stage in the entire process .. (meaningless here as well) .
the third line is what i want to add to the script (c-shell of course means use the c-shell commands).
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question