?
Solved

Multiple argument scripts .....

Posted on 1997-10-09
6
Medium Priority
?
273 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 200 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 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