11-05-2007
Quote:
Originally Posted by
porter
The four primary ways of inputting some to a program (no matter the language the program is written in)
(a) command line argument, like your file argument
(b) environment variables, typically need to export from a shell script
(c) as stdin, basically the input stream to a program
(d) as a generic file, where the program looks for well-known files.
I have tried
export $MY_VARIABLE
and then reading $MY_VARIABLE in perl program. I didnt get any value!
I tried as command line argument, however since I already have one file as input paramenter, it is interpreting another also as file input and I get a message that $MY_VARIABLE file does not exists.
Can you please show me syntax of passing file as one parameter and value as another parameter? or any other way?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need a non-perl (bash) way to strip the path from a list of "find" results. Below is the perl version which I could use, if I could figure out how to call the script with a variable (like in sh, $1 is the variable passed in ./script variable)
$file = "/path/to/file.txt";
# How do I... (2 Replies)
Discussion started by: TheCrunge
2 Replies
2. Shell Programming and Scripting
I'm writing a script to automate some post-install tasks on RHEL4 servers.
I need the following code to insert an 'A' in the middle of a string, then replace the string in a file. I know I can use sed to do this, but I'd like to use perl's in place edit so I don't have to write to a temp file,... (1 Reply)
Discussion started by: Xek
1 Replies
3. Shell Programming and Scripting
Hi there,
I am trying to call a shell script from a Perl script. here is the code:
@args = ("sh", "someshellprg.sh", "a file handler", "an array");
system(@args) == 0
or die "system @args failed: $?";
in the shell program, I examine if the arguments exits using:
if
then echo... (5 Replies)
Discussion started by: pinkgladiator
5 Replies
4. Shell Programming and Scripting
I have a script (say script1.sh ) and I am calling a script (say script2.sh) within the script1.sh. Here in script1.sh I have a hash ( say %hash1) and i have to pass this hash to script2.sh. Basically i have to do some processing in Scirpt2.sh based on the hash(key,values). I wanted to know how can... (2 Replies)
Discussion started by: ammu
2 Replies
5. Shell Programming and Scripting
Hi All,
I am trying to pass an argument called "Pricelist" to a Perl function, then the function will open and print out the contents of the file named "Pricelist". But i can't seem to do it using my below code. Can any expert give some advice?
#!/usr/local/bin/perl
$DATABASE =... (1 Reply)
Discussion started by: Raynon
1 Replies
6. Shell Programming and Scripting
Hi ,
This script working for fine if pass script-name.sh Jul/10/2007 ,I want to pass 20070710(yyyymmdd) .Please any help it should be appereciated.
use Time::Local;
my $d = $ARGV;
my $t = $ARGV;
my $m = "";
@d = split /\//, $d;
@t = split /:/, $t;
if ( $d eq "Jan" ) { $m = 0 }... (7 Replies)
Discussion started by: akil
7 Replies
7. Shell Programming and Scripting
Can we pass perl variable to shell commands. If yes, please give some example. (2 Replies)
Discussion started by: Anjan1
2 Replies
8. Shell Programming and Scripting
Greetings all,
If I have a SH script that calls a PERL script in the following way:
perl $HOME/scripts/config.properties
And in the config.properties PERL file, this Perl script only sets a number of environmental parameters in the following way:
#!/usr/bin/perl
$VAR1 = (
... (3 Replies)
Discussion started by: gikyo12
3 Replies
9. Shell Programming and Scripting
Semi-newbie, so flame throwers to 'singe-only', please. ;-)
I have a large number of (say) .html files, where I'd like to do a recursive in-place search and replace a particular string. The following bit of perl works fine:
perl -pi -e 's/oldstring/newstring/g' `find ./ -name *.html`
... (2 Replies)
Discussion started by: johnny_canucl
2 Replies
10. Shell Programming and Scripting
I am working on converting shell to Perl script. In shell we have built in function
trap
Do you know alternative in Perl or actually we don't need it?
Thanks for contribution (3 Replies)
Discussion started by: digioleg54
3 Replies
LEARN ABOUT CENTOS
malaga
MALAGA(1) Malaga quick reference MALAGA(1)
NAME
malaga - natural-language word and sentence analysis
SYNOPSIS
malaga [-morphology|-syntax] [-quoted] [-input input] project-file
DESCRIPTION
Malaga is a development environment for natural-language grammars based on the Left-Associative Grammar formalism. Malaga grammars can be
used for automatic morphological and/or syntactic analysis.
The program malaga is Malaga's user interface for analysing word forms and sentences, displaying the results and finding bugs in a grammar.
malaga requires the name of a language-dependent project-file as a command-line argument.
If no command line options are given, malaga starts in interactive mode, and you can enter commands. If you are not sure about the name of
a command, use the command help to get an overview of all malaga commands.
If you want to quit malaga, enter the command quit.
See info Malaga for details.
OPTIONS
-h[elp]
Print a help text about malaga's command line arguments and exit.
-i[nput] input
Analyse a single word or sentence given as command line argument (only valid in morphology or syntax mode).
-m[orphology]
Start malaga in morphology mode. In this mode word forms are read in from the standard input stream and analysed (one word form per
line). The analysis result are written to the standard output stream.
-q[uoted]
The input lines to be analysed are quoted (only valid in morphology or syntax mode).
-s[yntax]
Start malaga in syntax mode. In this mode sentences are read in from the standard input stream and analysed (one sentence per
line). The analysis result is written to the standard output stream.
-v[ersion]
Print malaga's version number and exit.
AUTHORS
Malaga was written by Bjoern Beutel. Numerous other people distributed to Malaga. This manpage was originally written for the Debian dis-
tribution by Antti-Juhani Kaijanaho.
SEE ALSO
mallex(1), malmake(1), malrul(1), malshow(1), malsym(1)
``Malaga 7, User's and Programmer's Manual''. Available in Debian systems via info Malaga, and, if the malaga-doc package is installed, in
various formats (DVI, Postscript, PDF, HTML) under /usr/share/doc/malaga-doc/.
Malaga 26 September 2006 MALAGA(1)