08-23-2009
Can we pass an array of strings from a Perl Program to a Shell Script?
Hi Folks,
The subject is my question:
Can we pass an array of strings from a Perl Program to a Shell Script?
Please provide some sample code.
Thanks
---------- Post updated at 11:52 PM ---------- Previous update was at 11:43 PM ----------
I got it.
Its here:
https://www.unix.com/shell-programmin...ll-script.html
10 More Discussions You Might Find Interesting
1. Programming
Hi,
Iam calling a C program from a Unix shell script. The (C) program reads encrypted username/password from a text file , decrypts and returns the decrypted string.
Is there any way i can return the decrypted string to Unix shell program.
My shell script uses the output of the program to... (11 Replies)
Discussion started by: satguyz
11 Replies
2. Programming
Hi,
I'm having a requirement where I need to call a C program from a shell script and return the value from the C program to shell script.
I refered a thread in this forum. But using that command in the code, it is throwing an error
clear_text_password=$(get_password)
Error: bash:... (24 Replies)
Discussion started by: venkatesh_sasi
24 Replies
3. Programming
Hi,
In the below C code , i want to pass the array to a unix shel script.
my script should called as ex myscript 1,2,3
#include <stdio.h>
int main()
{
int a={1,2,3};
}
Thanks,
Arun (1 Reply)
Discussion started by: arunkumar_mca
1 Replies
4. Shell Programming and Scripting
I have a perl script that opens a text file containing numbers on each line:
for example:
755993
755994
755995
755996
755997
755998
The perl script takes these numbers and store them as an array @raw_data, where I can access individual numbers by using $raw_data for the value 755993.... (2 Replies)
Discussion started by: xchen89x
2 Replies
5. Shell Programming and Scripting
Hi all,
Not sure if this should be in the programming forum, but I believe it will get more response under the Shell Programming and Scripting FORUM.
Am trying to write a customized df script in Perl and need some help with regards to using arrays and file handlers.
At the moment am... (3 Replies)
Discussion started by: newbie_01
3 Replies
6. UNIX for Dummies Questions & Answers
Hello..
I am developing a Graphical User Interface using GTK. As part of our project I need to take inputs from GTK entries and pass those inputs to shell script and use them in shell script. The problem which struck me is only limited number of inputs are getting passed to shell script. For now... (14 Replies)
Discussion started by: kalyanilinux
14 Replies
7. Shell Programming and Scripting
I want to create an array which can store the strings from the user input in shell script .
example :-
I want to store the 5 fruits name in a single array which the user provides . (1 Reply)
Discussion started by: Pkast
1 Replies
8. Shell Programming and Scripting
hi,
I have a array say
SAP_ARRAY="s1.txt"
SAP_ARRAY="s2.txt"
how can i pass this full array to a function.
here is the sample code i am using..
CHECK_NO_FILES()
{
FARRAY=$1
echo "FARRAY = $FARRAY"
echo "FARRAY = $FARRAY"
............... (5 Replies)
Discussion started by: Little
5 Replies
9. Shell Programming and Scripting
Dear Friends,
Please help me on this
my script name is send.csh
In this i have written the statement like this
set args = ( city state country price )
I want to pass this array to another c shell called receiver.csh. and i want to use it in this c shell
or
how to pass to... (2 Replies)
Discussion started by: SA_Palani
2 Replies
10. Shell Programming and Scripting
I'm able to read & print an array in varaible called "filelist"
I need to pass this array variable to a function called verify() and then read and loop through the passed array inside the function.
Unfortunately it does not print the entire array from inside the funstion's loop.
#/bin/ksh... (5 Replies)
Discussion started by: mohtashims
5 Replies
LEARN ABOUT PHP
parse_url
PARSE_URL(3) 1 PARSE_URL(3)
parse_url - Parse a URL and return its components
SYNOPSIS
mixed parse_url (string $url, [int $component = -1])
DESCRIPTION
This function parses a URL and returns an associative array containing any of the various components of the URL that are present.
This function is not meant to validate the given URL, it only breaks it up into the above listed parts. Partial URLs are also accepted,
parse_url(3) tries its best to parse them correctly.
PARAMETERS
o $url
- The URL to parse. Invalid characters are replaced by _.
o $component
- Specify one of PHP_URL_SCHEME, PHP_URL_HOST, PHP_URL_PORT, PHP_URL_USER, PHP_URL_PASS, PHP_URL_PATH, PHP_URL_QUERY or
PHP_URL_FRAGMENT to retrieve just a specific URL component as a string (except when PHP_URL_PORT is given, in which case the
return value will be an integer).
RETURN VALUES
On seriously malformed URLs, parse_url(3) may return FALSE.
If the $component parameter is omitted, an associative array is returned. At least one element will be present within the array. Potential
keys within this array are:
o$scheme - e.g. http
o$host
o$port
o$user
o$pass
o$path
o$query - after the question mark
?
o$fragment - after the hashmark
#
If the $component parameter is specified, parse_url(3) returns a string (or an integer, in the case of PHP_URL_PORT) instead of an array.
If the requested component doesn't exist within the given URL, NULL will be returned.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.4.7 | |
| | |
| | Fixed host recognition when scheme is omitted |
| | and a leading component separator is present. |
| | |
| 5.3.3 | |
| | |
| | Removed the E_WARNING that was emitted when URL |
| | parsing failed. |
| | |
| 5.1.2 | |
| | |
| | Added the $component parameter. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
A parse_url(3) example
<?php
$url = 'http://username:password@hostname:9090/path?arg=value#anchor';
var_dump(parse_url($url));
var_dump(parse_url($url, PHP_URL_SCHEME));
var_dump(parse_url($url, PHP_URL_USER));
var_dump(parse_url($url, PHP_URL_PASS));
var_dump(parse_url($url, PHP_URL_HOST));
var_dump(parse_url($url, PHP_URL_PORT));
var_dump(parse_url($url, PHP_URL_PATH));
var_dump(parse_url($url, PHP_URL_QUERY));
var_dump(parse_url($url, PHP_URL_FRAGMENT));
?>
The above example will output:
array(8) {
["scheme"]=>
string(4) "http"
["host"]=>
string(8) "hostname"
["port"]=>
int(9090)
["user"]=>
string(8) "username"
["pass"]=>
string(8) "password"
["path"]=>
string(5) "/path"
["query"]=>
string(9) "arg=value"
["fragment"]=>
string(6) "anchor"
}
string(4) "http"
string(8) "username"
string(8) "password"
string(8) "hostname"
int(9090)
string(5) "/path"
string(9) "arg=value"
string(6) "anchor"
Example #2
A parse_url(3) example with missing scheme
<?php
$url = '//www.example.com/path?googleguy=googley';
// Prior to 5.4.7 this would show the path as "//www.example.com/path"
var_dump(parse_url($url));
?>
The above example will output:
array(3) {
["host"]=>
string(15) "www.example.com"
["path"]=>
string(5) "/path"
["query"]=>
string(17) "googleguy=googley"
}
NOTES
Note
This function doesn't work with relative URLs.
Note
This function is intended specifically for the purpose of parsing URLs and not URIs. However, to comply with PHP's backwards com-
patibility requirements it makes an exception for the file:// scheme where triple slashes (file:///...) are allowed. For any other
scheme this is invalid.
SEE ALSO
pathinfo(3), parse_str(3), http_build_query(3), http_build_url(3), dirname(3), basename(3), RFC 3986.
PHP Documentation Group PARSE_URL(3)