Sponsored Content
Top Forums Shell Programming and Scripting Passing a file handler and an array from Perl to Shell Script Post 302259319 by pinkgladiator on Monday 17th of November 2008 10:00:05 PM
Old 11-17-2008
Strange! I used the following script to see how many lines of code I have, and it says 1, but I have two lines of code.

a=0
while read line
do a=$(($a+1));
echo $a;
done < "/home/.../emailFile.txt"
echo "Final line count is: $a";
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script signal handler

AIX 4.3.3 I am trying to write a signal handler into a ksh shell script. I would like to capture the SIGTERM, SIGINT, and the SIGTSTP signals, print out a message to the terminal, and continue executing the script. I have found a way to block the signals: #! /bin/ksh SIGTERM=15 SIGINT=2... (2 Replies)
Discussion started by: jalburger
2 Replies

2. Shell Programming and Scripting

Passing value from shell script to .pls file

I have a shell script which takes at the command prompt options like ss1.sh -F SCOTT -T JOHN F- From User T- To User I want to pass the From User(SCOTT) Value to another script ss2.pls (This script runs a PL/SQL Program). Depending on the FromUser value in the ss1.sh script i have to... (4 Replies)
Discussion started by: dreams5617
4 Replies

3. Shell Programming and Scripting

Need help passing variables in shell script to perl one-liner

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

4. Shell Programming and Scripting

Passing parameter from one file to shell script

Hi All, I have a 2 files. File1 i am generating using an ETL tool, which is a comman seperated delimited file which contains country code & load date. everytime, this country code will be updated from a table. It might be AB or BA & ld_date will be for which date we need to load the file. ... (7 Replies)
Discussion started by: Amit.Sagpariya
7 Replies

5. Shell Programming and Scripting

Perl Function Array Arguement Passing

Hi All, I have some questions regarding array arguements passing for Perl Function. If @array contains 2 items , arguements passing would be like Code_A. But what if @array needs to add in more items, the rest of the code like $_ will have to be modified as well (highlighted in red), which is... (5 Replies)
Discussion started by: Raynon
5 Replies

6. Shell Programming and Scripting

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:... (0 Replies)
Discussion started by: som.nitk
0 Replies

7. Shell Programming and Scripting

HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl

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

8. Shell Programming and Scripting

Passing Shell array to SQLPlus

Dears, Newbie here and tried to search this topic for 3 days now with results. I have a shell array and I want to use it in sqlplus with one connection. here is what I have for now #!/bin/ksh FileName=1000 FileName=2000 FileName=3000 FileName=4000 sqlplus /nolog <<EOF connect... (20 Replies)
Discussion started by: roby2411
20 Replies

9. Shell Programming and Scripting

Passing PERL var values to SH Shell Script

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

10. Shell Programming and Scripting

Passing values to an XML file from shell script

:wall: Hi, I have an XML file with 5 tags. I need to pass values to the XML file from a shell script that will replace values in 2 of the tags. I cannot hardcode the tag values in XML and use replace command in script as the values are likely to change. Please help !!!!!!!!!!! (2 Replies)
Discussion started by: Monalisaa
2 Replies
PHP(1)								Scripting Language							    PHP(1)

NAME
php - PHP Command Line Interface 'CLI' SYNOPSIS
php [options] [ -f ] file [[--] args...] php [options] -r code [[--] args...] php [options] [-B code] -R code [-E code] [[--] args...] php [options] [-B code] -F file [-E code] [[--] args...] php [options] -- [ args...] php [options] -a DESCRIPTION
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. This is the command line interface that enables you to do the following: You can parse and execute files by using parameter -f followed by the name of the file to be executed. Using parameter -r you can directly execute PHP code simply as you would do inside a .php file when using the eval() function. It is also possible to process the standard input line by line using either the parameter -R or -F. In this mode each separate input line causes the code specified by -R or the file specified by -F to be executed. You can access the input line by $argn. While processing the input lines $argi contains the number of the actual line being processed. Further more the parameters -B and -E can be used to execute code (see -r) before and after all input lines have been processed respectively. Notice that the input is read from STDIN and therefore reading from STDIN explicitly changes the next input line or skips input lines. If none of -r -f -B -R -F or -E is present but a single parameter is given then this parameter is taken as the filename to parse and exe- cute (same as with -f). If no parameter is present then the standard input is read and executed. OPTIONS
--interactive -a Run PHP interactively. This lets you enter snippets of PHP code that directly get executed. When readline support is enabled you can edit the lines and also have history support. --bindpath address:port|port -b address:port|port Bind Path for external FASTCGI Server mode (CGI only). --no-chdir -C Do not chdir to the script's directory (CGI only). --no-header -q Quiet-mode. Suppress HTTP header output (CGI only). --timing count -T count Measure execution time of script repeated count times (CGI only). --php-ini path|file -c path|file Look for php.ini file in the directory path or use the specified file --no-php-ini -n No php.ini file will be used --define foo[=bar] -d foo[=bar] Define INI entry foo with value bar -e Generate extended information for debugger/profiler --file file -f file Parse and execute file --global name -g name Make variable name global in script. --help -h This help --hide-args -H Hide script name (file) and parameters (args...) from external tools. For example you may want to use this when a php script is started as a daemon and the command line contains sensitive data such as passwords. --info -i PHP information and configuration --syntax-check -l Syntax check only (lint) --modules -m Show compiled in modules --run code -r code Run PHP code without using script tags '<?..?>' --process-begin code -B code Run PHP code before processing input lines --process-code code -R code Run PHP code for every input line --process-file file -F file Parse and execute file for every input line --process-end code -E code Run PHP code after processing all input lines --syntax-highlight -s Output HTML syntax highlighted source --version -v Version number --stripped -w Output source with stripped comments and whitespace --zend-extension file -z file Load Zend extension file args... Arguments passed to script. Use '--' args when first argument starts with '-' or script is read from stdin --rfunction name --rf name Shows information about function name --rclass name --rc name Shows information about class name --rextension name --re name Shows information about extension name --rextinfo name --ri name Shows configuration for extension name --ini Show configuration file names FILES
/etc/php5/cli/php.ini The configuration file for the CLI version of PHP. /etc/php5/cgi/php.ini The configuration file for the CGI version of PHP. /etc/php5/apache2/php.ini The configuration file for the version of PHP that apache2 uses. EXAMPLES
php -r 'echo "Hello World ";' This command simply writes the text "Hello World" to standard out. php -r 'print_r(gd_info());' This shows the configuration of your gd extension. You can use this to easily check which image formats you can use. If you have any dynamic modules you may want to use the same ini file that php uses when executed from your webserver. There are more extensions which have such a function. For dba use: php -r 'print_r(dba_handlers(1));' php -R 'echo strip_tags($argn)." ";' This PHP command strips off the HTML tags line by line and outputs the result. To see how it works you can first look at the following PHP command 'php -d html_errors=1 -i' which uses PHP to output HTML formatted configuration information. If you then combine those two 'php ...|php ...' you'll see what happens. php -E 'echo "Lines: $argi ";' Using this PHP command you can count the lines being input. php -R '@$l+=count(file($argn));' -E 'echo "Lines:$l ";' In this example PHP expects each input line being a file. It counts all lines of the files specified by each input line and shows the summarized result. You may combine this with tools like find and change the php scriptlet. php -R 'echo "$argn "; fgets(STDIN);' Since you have access to STDIN from within -B -R -F and -E you can skip certain input lines with your code. But note that in such cases $argi only counts the lines being processed by php itself. Having read this you will guess what the above program does: skipping every second input line. TIPS
You can use a shebang line to automatically invoke php from scripts. Only the CLI version of PHP will ignore such a first line as shown below: #!/bin/php <?php // your script ?> SEE ALSO
For a more or less complete description of PHP look here: http://www.php.net/manual/ BUGS
You can view the list of known bugs or report any new bug you found at: http://bugs.php.net AUTHORS
The PHP Group: Thies C. Arntzen, Stig Bakken, Andi Gutmans, Rasmus Lerdorf, Sam Ruby, Sascha Schumann, Zeev Suraski, Jim Winstead, Andrei Zmievski. Additional work for the CLI sapi was done by Edin Kadribasic, Marcus Boerger and Johannes Schlueter. A List of active developers can be found here: http://www.php.net/credits.php And last but not least PHP was developed with the help of a huge amount of contributors all around the world. VERSION INFORMATION
This manpage describes php, version 5.3.6-13ubuntu3.10. COPYRIGHT
Copyright (C) 1997-2010 The PHP Group This source file is subject to version 3.01 of the PHP license, that is bundled with this package in the file LICENSE, and is available through the world-wide-web at the following url: http://www.php.net/license/3_01.txt If you did not receive a copy of the PHP license and are unable to obtain it through the world-wide-web, please send a note to license@php.net so we can mail you a copy immediately. The PHP Group 2010 PHP(1)
All times are GMT -4. The time now is 05:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy