Sponsored Content
Top Forums Shell Programming and Scripting calling a program (w/ params) from within shell Post 302243759 by Lorna on Monday 6th of October 2008 02:10:36 PM
Old 10-06-2008
Ok let me try to rephrase my question

The program s2 can be run in command line by typing:

>s2 param1=val1 param2=val2
>enter value of param3: val3
>enter value of param4[2000] ;return key accepts default
> ...................

Now from within my shell script I did:

param1= val1
param2=val2
param3=val3

s2 param1=$param1 param2=$param2
echo $param3
echo -e '\r'

the program runs but with errors as it doesnt get the values of the params I feed it through my shell script correctly
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling SHELL script from C program

Hi, I just tried to call a simple script from a pretty simple C program. I could not succeed :-( a message was thrown saying "sh: line 1: "Script name with path": Permission denied" The C program and shell script are below, both are in the same directory and shell script is given... (7 Replies)
Discussion started by: Chanakya.m
7 Replies

2. UNIX for Advanced & Expert Users

calling program

hi, i have a script.sh on my machine and it used in the system but my question is how can i know the program called this script.sh?? i.e. from where it called and execute?? Many thanks (1 Reply)
Discussion started by: alzuma
1 Replies

3. Shell Programming and Scripting

Calling Functions of Other K Shell Program

Hi, I have a K shell a.ksh function abc { // Some logic } In b.ksh i have included the a.ksh ./a.ksh I want to call the abc function from this b.ksh script. Thanks Vijay (2 Replies)
Discussion started by: vijaykrc
2 Replies

4. UNIX for Advanced & Expert Users

calling a Universe program

Can someone offer some technical advice concerning an call to a IBM U2 (Universe) program? When I use the following script from a unix shell, it works fine: $ " xxx.sh " (contains the following --->) 1. cd /links/ACCOUNT1 2. /shapps/ibm/uv/bin/uv "COUNT FILE1" ... (2 Replies)
Discussion started by: smintz
2 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

Calling a shell script from a C program

Hi, I have a shell script which connects to a database and fetches the count of the records from a table. I want to embed this whole script in a C program. Also the count fetched should be available in the C program for further usage. Please let me know how this can be done. Thanks ... (0 Replies)
Discussion started by: swasid
0 Replies

7. Programming

Calling a shell script from a C program

Hi, I have a shell script which connects to a database and fetches the count of the records from a table. I want to embed this whole script in a C program. Also the count fetched should be available in the C program for further usage. Please let me know how this can be done. Thanks (9 Replies)
Discussion started by: swasid
9 Replies

8. Shell Programming and Scripting

Calling perl script in shell program

How to call a perl script in shell program / shell scripting. PLS HELP ME (2 Replies)
Discussion started by: hravisankar
2 Replies

9. Homework & Coursework Questions

Calling compiled C program with Perl program

Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies

10. Programming

Program crashes on calling __libc_msgrcv()

Hi, I am a newbie to linux programming. I have implemented msgqueue in C. msgrcv() call at the client end is as below: msgrcv( msgqid, msgptr, msgsize, msgtype, 0 ); My program works fine when msgrcv () from /lib/libc.so.6 is called. However it crashes when __libc_msgrcv() is called. ... (3 Replies)
Discussion started by: praasanna
3 Replies
Config::YAML(3pm)					User Contributed Perl Documentation					 Config::YAML(3pm)

NAME
Config::YAML - Simple configuration automation VERSION
Version 1.42 SYNOPSIS
Config::YAML is a somewhat object-oriented wrapper around the YAML module which makes reading and writing configuration files simple. Handling multiple config files (e.g. system and per-user configuration, or a gallery app with per-directory configuration) is a snap. use Config::YAML; # create Config::YAML object with any desired initial options # parameters; load system config; set alternate output file my $c = Config::YAML->new( config => "/usr/share/foo/globalconf", output => "~/.foorc", param1 => value1, param2 => value2, ... paramN => valueN, ); # integrate user's own config $c->read("~/.foorc"); # integrate command line args using Getopt::Long $rc = GetOptions ( $c, 'param1|p!', 'param2|P', 'paramN|n', ); # Write configuration state to disk $c->write; # simply get params back for use... do_something() unless $c->{param1}; # or get them more OO-ly if that makes you feel better my $value = $c->get_param2; METHODS
new Creates a new Config::YAML object. my $c = Config::YAML->new( config => initial_config, output => output_config ); The "config" parameter specifies the file to be read in during object creation. It is required, and must be the first parameter given. If the second parameter is "output", then it is used to specify the file to which configuration data will later be written out. This positional dependency makes it possible to have parameters named "config" and/or "output" in config files. Initial configuration values can be passed as subsequent parameters to the constructor: my $c = Config::YAML->new( config => "~/.foorc", foo => "abc", bar => "xyz", baz => [ 1, 2, 3 ], ); get_*/set_* If you'd prefer not to directly molest the object to store and retrieve configuration data, autoloading methods of the forms "get_[param]" and "set_[param]" are provided. Continuing from the previous example: print $c->get_foo; # prints "abc" my $val = $c->get_quux; # $c->{quux} doesn't exist; returns undef $c->set_bar(30); # $c->{bar} now equals 30, not "xyz" my @list = qw(alpha beta gamma); $c->set_baz(@list); # $c->{baz} now a reference to @list fold Convenience method for folding multiple values into the config object at once. Requires a hashref as its argument. $prefs{theme} = param(theme); $prefs{format} = param(format); $prefs{sortby} = param(order); $c->fold(\%prefs); my $format = $c->get_format; # value matches that of param(format) read Imports a YAML-formatted config file. $c->read('/usr/share/fooapp/fooconf'); "read()" is called at object creation and imports the file specified by "new(config=>)", so there is no need to call it manually unless multiple config files exist. write Dump current configuration state to a YAML-formatted flat file. $c->write; The file to be written is specified in the constructor call. See the "new" method documentation for details. DEPRECATED METHODS
These methods have been superceded and will likely be removed in the next release. get Returns the value of a parameter. print $c->get('foo'); set Sets the value of a parameter: $c->set('foo',1); my @paints = qw( oil acrylic tempera ); $c->set('paints', @paints); AUTHOR
Shawn Boyette ("<mdxi@cpan.org>") Original implementation by Kirrily "Skud" Robert (as "YAML::ConfigFile"). BUGS
o Config::YAML ignores the YAML document separation string ("---") because it has no concept of multiple targets for the data coming from a config file. Please report any bugs or feature requests to "bug-yaml-configfile@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. COPYRIGHT &; LICENSE Copyright 2004 Shawn Boyette, All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-03-07 Config::YAML(3pm)
All times are GMT -4. The time now is 05:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy