I am at a loss as to what you are trying to do.
IF you are sourcing a file, . /path/to/file then that will execute inside the parent shell.
Variables will be passed at that position where the sourced file is...
A quick demo...
Sourced file:
AND parent file:
Results OSX 10.14.6, default shell terminal.
HPUX11.0/Korn Shell
I have an old script that takes in a series of arguments when its called. The script is really more of a common set of functions that gets called by other scripts as needed. I have been asked to make this into a menu driven script to rollout to app support for their use during... (2 Replies)
A good place to start is simple variable passing....
Passing variables from one script to another
The next level is passing a variable into a more complex command such as using a variable in a sed command. There are some simple quoting techniques that are very general. These are mentioned... (0 Replies)
Hello,
I am using the Bourne shell.
I am trying to understand the concept of positional parameters.
I do understand that positional parameters:
1. Are initialized by shell
2. Have a max of 9 parameters ($1 to $9)
3. Have no limit on the number of arguments
4. Can be rearranged... (15 Replies)
I need to get file names from commandline arguments, it may be any no of arguements, Using for loop i got but how do i display it, bcoz $i will give the number i is assigned $$i is not working either $($i), i need the names of the files got in the arguement (2 Replies)
Hi,
Can any one provide the Unix command to reset the positional parameters?
Please see the below example where i have to pass 2 parameters to Shell1.sh.
Step1) . ./Shell1.sh 2 3
successfully executed, Then i executed(next step only) the same shell script again,this time no... (4 Replies)
Hi all,
I have one small requirment...
I have prepared one script. we have to pass two possitional parameters to the script. What I want to do is if the parameters are not passed then i dont want the script to start the process...
For ex:
$ ./a.sh parm1 parm2
#Here, it can start... (7 Replies)
In a Bash script I used getopts command to let a user does something regards to the selected options. The question is: How do you find out what is the name of the file that user inserted in the command line like the following:
The good part is this file is always the last argument in the... (2 Replies)
I'm new with 'sed' and for sure something still I don't understand yet with it. If you see my output on ">Output..." portion, the new directory still on "source_dir" instead of "dest_dir". You may disregard for the "tar" part, this is just a test script, just for me to understand 'sed' using the... (3 Replies)
I am trying to code an if statement that accepts two parameters and see if those parameters are in another file called teledir.txt. If it already exists in the file, it is to say "Entry Exists". If not, I add it to the file and say "Entry Added". This is the code I have so far:
if ; then
... (1 Reply)
Discussion started by: Eric7giants
1 Replies
LEARN ABOUT DEBIAN
perl5i::signature
Signature(3pm) User Contributed Perl Documentation Signature(3pm)NAME
perl5i::Signature - Representing what parameters a subroutine accepts
SYNOPSIS
func hello( $greeting, $place ) { say "$greeting, $place" }
my $code = &hello;
my $signature = $code->signature;
say $signature->num_positional_params; # 2
say $signature->is_method; # false
DESCRIPTION
A Signature is a representation of what parameters a subroutine accepts. Each subroutine defined with "func" or "method" will have a
signature associated with it. You can get at it by calling the "signature" method on the code reference. See "Signature Introspection" in
perl5i for more details.
Subroutines declared with Perl's built in "sub" will have no signature.
METHODS
params
my $params = $sig->params;
An array ref of the parameters a subroutine takes in the order it takes them. Currently they are just strings. In the future they will be
string overloaded objects.
positional_params
my $params = $sig->positional_params;
Like "$sig->params" but it is just the positional parameters.
In the future there will be named parameters.
num_positional_params
my $num_positional_params = $sig->num_positional_params;
The number of named parameters the subroutine takes.
In the future there will be named parameters. For the purposes of determining how many arguments a function takes, it is most useful to
look just at the positional ones.
This is mostly an optimization for "$sig->positional_params->size".
as_string
my $params = $sig->as_string;
The original signature string.
invocant
my $invocant = $sig->invocant;
The invocant is the object or class a method is called on. "invocant" will return the parameter which contains this, by default it is
$self on a method, and nothing a regular subroutine.
is_method
my $is_method = $sig->is_method;
Returns if the subroutine was declared as a method.
OVERLOADING
Signature objects are string overloaded to return "as_string". They are also always true to avoid objects taking no parameters from being
confused with subroutines with no signatures.
perl v5.14.2 2012-06-14 Signature(3pm)