How to pass command line argument in shell script?
I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like
and Exit from the script
Hi,
I am facing a problem to pass command line arguments that looks like
<script name> aa bb "cc" dd "ee"
I want to pass all 5 elements include the " (brackets). when I print the @ARGV the " disappear. I hope I explain myself
Regards,
Ziv (4 Replies)
Hi,
I had written a shell script to pass command line argument to variable in a function.
Here is my code:
main
if ; then
.$1
echo $1
get_input_file
else
echo "input file $1 is not available"
fi
get_input_file()
{
FILE = "$1"
echo $FILE
} (10 Replies)
i want to write a shell script function that will ftp the files passed in the command line . i have written a shell script for ftp but how will it do for all files passed in command line argument ,
i am passing 4 files as argument
./ftp.sh file1 file2 file3 file4
code written by me... (5 Replies)
Can someone let me know how could I achieve this
In one of per script I am calling the shell script but I need to so one thing that is one shell script call I need to pass pne argument.In below code I am calling my ftp script but here I want to pass one argument so how could I do this (e.g:... (5 Replies)
Hi,I have a script which is given below :#!/bin/bash. ini_script.shdb2 connect to $DB_NAME user $DB2_UID using $DB2_PASSWORDfor file in `ls -1 ./sql/ddw/`do echo "Executing the file $file" echo db2 -tvf $filedonedb2 quiti want this script to accept directorie's names present in... (1 Reply)
hi,
I am new in the shell script, and c programming with linux. I am looking to pass the arguments in c program that should be executed by the shell script.
e.g.
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv)
{ int i;
for (i=1;i<argc; i++)
{
... (2 Replies)
I need to write a shell script, when I run that script I should pass those arguments if not, then script should not run and pass the error message like
invalid option - - should pass the argument.
and Exit from the script
https://www.unix.com/images/misc/progress.gif (1 Reply)
Hi all,
$ echo $SHELL
/bin/bash
Requirement - How to pass oracle sql script as argument to unix shell script?
$ ./output.sh users.sql
Below are the shell scripts and the oracle sql file in the same folder.
Shell Script
$ cat output.sh
#!/bin/bash
.... (7 Replies)
I'm looking to write a script that takes a .txt filename as an argument, reads the file line by line, and passes each line to a command. For example, it runs command --option "LINE 1", then command --option "LINE 2", etc. I am fetching object files from a library file, I have all the object file... (2 Replies)
Discussion started by: Paul Martins
2 Replies
LEARN ABOUT DEBIAN
plack::runner
Plack::Runner(3pm) User Contributed Perl Documentation Plack::Runner(3pm)NAME
Plack::Runner - plackup core
SYNOPSIS
# Your bootstrap script
use Plack::Runner;
my $app = sub { ... };
my $runner = Plack::Runner->new;
$runner->parse_options(@ARGV);
$runner->run($app);
DESCRIPTION
Plack::Runner is the core of plackup runner script. You can create your own frontend to run your application or framework, munge command
line options and pass that to "run" method of this class.
"run" method does exactly the same thing as the plackup script does, but one notable addition is that you can pass a PSGI application code
reference directly to the method, rather than via ".psgi" file path or with "-e" switch. This would be useful if you want to make an
installable PSGI application.
Also, when "-h" or "--help" switch is passed, the usage text is automatically extracted from your own script using Pod::Usage.
NOTES
Do not directly call this module from your ".psgi", since that makes your PSGI application unnecessarily depend on plackup and won't run
other backends like Plack::Handler::Apache2 or mod_psgi.
If you really want to make your ".psgi" runnable as a standalone script, you can do this:
my $app = sub { ... };
unless (caller) {
require Plack::Runner;
my $runner = Plack::Runner->new;
$runner->parse_options(@ARGV);
return $runner->run($app);
}
return $app;
WARNING: this section used to recommend "if (__FILE__ eq $0)" but it's known to be broken since Plack 0.9971, since $0 is now always set to
the .psgi file path even when you run it from plackup.
SEE ALSO
plackup
perl v5.14.2 2012-03-21 Plack::Runner(3pm)