Sponsored Content
Top Forums Shell Programming and Scripting possible to run script to enter info within a program? Post 74450 by Perderabo on Thursday 9th of June 2005 06:40:08 PM
Old 06-09-2005
Post your script so we know what you tried. Also which version of unix? (uname -a will tell you) In the worst case you would need to use the program called "expect" which is available for free. It can fake out any interactive program. Do you have "expect" already? Try "which expect" to find out.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

want to run different files under the same program using shell script

suppose have different files 1.1 2.2 3.3 4.4 5.5 All the files have to run under the same command say tr -d '\n' so how to run all the files under the same command by using shell script (3 Replies)
Discussion started by: cdfd123
3 Replies

2. Programming

Getting process info in a program

Hi, I am wondering if there is a way to find out in a C software program if a particular process is running without having to write a file. In the past, I have been using the system command to execute a pgrep and output the info to a file. Then the C program reads the file to make the... (1 Reply)
Discussion started by: herbmiller
1 Replies

3. Programming

program or script to display user info

I'm on a Linux machine and need a program that will display user information as follows: user name, user directory and current date & time. I think we can compile C, C++ and Perl. All help is appreciated. (4 Replies)
Discussion started by: flasun
4 Replies

4. Shell Programming and Scripting

Can you run a unix script from a perl program

Hi all i have a unix script reformatter.sh i have a process whereby this script reformats a file before a perl program is used to update it i am having a little problem automating the entire process . is there a way whereby i can call the unix script from the perl program ? (12 Replies)
Discussion started by: dwightja24
12 Replies

5. Shell Programming and Scripting

Run shell script from C program by calling fork and execl

I need to write a c program that uses the fork and excel system calls to run the shell script mode invoked like this: "./mode 644 ls -l" (that is the argumetns will always be 644 ls -l) here's the mode script: #!/bin/sh octal="$1" shift find . -maxdepth 1 -perm $octal -exec $@ {} \; ... (3 Replies)
Discussion started by: computethis
3 Replies

6. Shell Programming and Scripting

How to enter commands to the command prompt in a program

Hey, So I'm trying to write a program in unix to automate a process for my astrophysics research. Basically I want the program to prompt the user for some information and store the entered string of text as a variable. I know how to do this. This is where I need help: Now lets say I have a... (4 Replies)
Discussion started by: freemoniez
4 Replies

7. Shell Programming and Scripting

Run a bash script, display on the screen and save all information in a file including error info

Hi all, How to: Run a bash script, display on the screen and save all information in a file including error information. For example: I have a bash script called test.sh now I want to run the test.sh and display the output on the screen and save the output including error info to a file. ... (1 Reply)
Discussion started by: Damon sine
1 Replies

8. Shell Programming and Scripting

Shell script to run a python program on multiple entries in a file

Hello I am trying to run a python program using shell script, which takes a single argument from a file. This file has one entry per line : 1aaa 2bbb 3ccc 4ddd 5eee ... ... ... My shell script runs the program, only for the last entry : #!/bin/sh IFS=$'\n' for line in $(cat... (2 Replies)
Discussion started by: ad23
2 Replies

9. Homework & Coursework Questions

Run Program from Bash CGI-Script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: This is a problem I am having with my 2 semester senior project. I have a LAMP server running Ubuntu 9.10 with... (8 Replies)
Discussion started by: JMooney5115
8 Replies

10. Shell Programming and Scripting

Perl program to run a Shell script issues...

Hi all, I have the following Perl script which is intended to run a Shell script and generate some logging for the purposes of tracking weather or not the script ran. I get an error, of course, since I don't know what I'm doing really. Here is the code: #!/opt/perl/bin/perl -w ... (14 Replies)
Discussion started by: zixzix01
14 Replies
DACSEXPR(1)						       DACS Commands Manual						       DACSEXPR(1)

NAME
dacsexpr - DACS expression language shell and interpreter SYNOPSIS
dacsexpr [-x] [dacsoptions[1]] [-dl] [-e expr] [-n] [-p] [-s] [-h | -help] [-test] [--] [filename] [script-arg...] DESCRIPTION
This program is part of the DACS suite. The dacsexpr utility evaluates DACS expressions (see dacs.exprs(5)[2]). It is often a useful aid when composing or testing expressions to be used in access control rules, or when debugging ACLs and configuration directives. While they continue to be referred to as "expressions" for historical reasons, it has become possible to write small programs, and the language can also be useful as a simple scripting language independent of the rest of DACS. If an expression is provided, it is evaluated and the result is printed to the standard output. At most one expression can be specified. If the -q flag is given (one of the dacsoptions[1]), nothing is printed, expression evaluation errors are suppressed, and the program terminates with an appropriate exit status[3]; otherwise the result is written to the standard output. If neither a -q flag is given nor any flag that controls the logging level, then the logging level is set to warn overriding any configuration file logging level directive; this behaviour is usually convenient. If no expression is provided, the program reads its standard input. If the input is not coming from a terminal type device, the program runs in "batch mode" and prompting is suppressed; otherwise, the program runs in "interactive mode". When prompted in interactive mode, enter help for assistance. If the readline(3)[4] functionality was configured when the program was built, command line editing and history are available in interactive mode. If the program is executed through the system's "#!" mechanism, one or more command line arguments can be given: #!/usr/local/dacs/bin/dacsexpr -test // expect-exact:17 ${x} = 17; Such programs always use the script file as input, therefore no expression or other file can be specified on the "#!" line. The Env namespace is initialized from the program's environment. For example, if the value of the environment variable LOGNAME is bobo, then ${Env::LOGNAME} will be instantiated with that value. Syntactically invalid variable names are silently ignored. Note Configuration directives and the Conf variable namespace are available only if a configuration file is processed (e.g., by giving the -uj command line flag). This is relevant, for example, if the http()[5] function is called using the https scheme because proper operation will require the SSL_PROG[6] directive to be configured. See dacs.conf(5)[7]. OPTIONS
If an expression or file has not already been specified, a filename may appear as the last argument. If filename is "-", the standard input is read. -dl Print debugging information to stderr. -e expr The given expression is evaluated. -h -help Display a help message and exit. -n Do not evaluate any expressions, only check for syntax errors. -p Print the final result to the standard output, unless it has been suppressed by -q or -n. Without this flag, the result would have to be output by the program. -s If a single expression is being evaluated from the command line or a file and the result of evaluation is a string or bstring, the output will be surrounded by quotes unless this flag is specified. -test The input is a test case. A test case consists of options followed by an expression. There can be zero or more options, one per line, embedded within a // style comment: { whitespace* "//" whitespace* option-name ":" option-value end-of-line }* No whitespace is allowed before or after the ":". As a special case, lines having the following format are ignored: whitespace* "///" .* end-of-line The first non-option line terminates the options and is the first line of the expression to be evaluated. Here is an example: /// Test bitwise shifts // expect-exact:1024 1 << 10 An option controls how the test is to be performed and gives the expected result: expect:regex expect-regex:regex The result string must match regex. These two option names are equivalent. expect-identical:string The result string must match string exactly. expect-exact:string The result string must match string exactly, except that C-style character constants (preceded by a backslash) in string are interpolated. expect-code:code The result code must match code, which is 0 if the result is True, 1 if the result is False, and 2 if an error occurs. If this option is not given, a default code of 0 is assumed. expect-type:type The type of the result must match type, which can be integer, real, string, bstring, literal, or undef. expect-flags:flags Currently, the only recognized values for flags are rw_namespaces and ro_namespaces. The former allows the test to create or modify variables in the DACS, Args, or Env namespace; by default, these namespaces are read-only. This might be useful when testing from()[8], for instance, because it allows the test to set a value for ${DACS::REMOTE_ADDR}. The default behaviour can be explicitly selected by specifying ro_namespaces. show-result:{yes | no} The result is printed to the standard output only if the option value is yes. If the test fails, a descriptive message is printed to the standard error. The program's exit status will be 0 if the test was successful, 1 otherwise. This example should succeed without displaying the result: // expect-exact:2 // expect-type:integer /// show-result:yes 1 + 1 Note The DACS distribution includes a set of test cases in the src/tests directory that can be run for regression testing (do "make tests" from the src directory). Some of the functions provided by dacs.exprs(5)[2] are also used internally by DACS, so it is critical that all tests are successful even for functions that are not used from the user level. -x If this is the very first flag it indicates that dacsexpr is being executed as a script via the system's "#!" mechanism. This might be useful if the program's heuristic for determining this is incorrect. The last argument must be a filename. -- This argument explicitly marks the last flag argument. A filename argument might follow. EXAMPLES
The following command evaluates the expression argument (note that it is a single argument to the command) and outputs the result to stdout: % dacsexpr -e "1+1" 2 % dacsexpr -e '${Env::USER}' "bobo" % dacsexpr -u example.com -e '"FEDERATION_NAME=" . ${Conf::FEDERATION_NAME}' "FEDERATION_NAME=EXAMPLE" % dacsexpr - a b c <<HERE ? print("First arg is "${Argv::1}"") ? HERE First arg is "a" % cat ex #!/usr/local/dacs/bin/dacsexpr print("Argv[2] is ${Argv::2}"); % chmod 0755 ex % ./ex foo bar baz Argv[2] is bar DIAGNOSTICS
If an error occurs, a message may be written to stderr, depending on the logging level. In general, the program exits 0 if and only if everything was fine. If a command line expression is evaluated, the program exits 0 if the expression evaluates to True, 1 if it evaluates to False, and 2 if an error occurs. If an explicit call to exit() is made and no true error condition occurred, then the program will exit with the argument value. SEE ALSO
dacs.exprs(5)[2] BUGS
New and little-used features should be used with care. This advice applies to all software. AUTHOR
Distributed Systems Software (www.dss.ca[9]) COPYING
Copyright2003-2012 Distributed Systems Software. See the LICENSE[10] file that accompanies the distribution for licensing information. NOTES
1. dacsoptions http://dacs.dss.ca/man/dacs.1.html#dacsoptions 2. dacs.exprs(5) http://dacs.dss.ca/man/dacs.exprs.5.html 3. exit status http://dacs.dss.ca/man/#diagnostics 4. readline(3) http://www.freebsd.org/cgi/man.cgi?query=readline&apropos=0&sektion=3&manpath=FreeBSD+9.0-RELEASE&format=html 5. http() http://dacs.dss.ca/man/dacs.exprs.5.html#http 6. SSL_PROG http://dacs.dss.ca/man/dacs.conf.5.html#SSL_PROG 7. dacs.conf(5) http://dacs.dss.ca/man/dacs.conf.5.html 8. from() http://dacs.dss.ca/man/dacs.exprs.5.html#from 9. www.dss.ca http://www.dss.ca 10. LICENSE http://dacs.dss.ca/man/../misc/LICENSE DACS 1.4.27b 10/22/2012 DACSEXPR(1)
All times are GMT -4. The time now is 03:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy