There is a flaw in your assumptions, not your understanding. Your understanding is right in that if a command reads from stdin, then it should be able to process the input that it gets. But 'echo' does not read from stdin. It simply processes its argument list and prints whatever it gets to stdout.
When you do 'ls * | echo', the number of arguments passed to 'echo' are 0. This causes the following part of echo's code to kick in:
I picked this up from the source code of 'echo' from the Solaris source.
To get the output that you want, you should execute something like this:
or
Hi. Im using cat to output the contents of a file, then piping it to my while read loop.In this loop variables get assigned values. However when i try to use the variables outside the loop their values has been reset.I understand about subshells etc. but I have no idea how to "preserve" the... (3 Replies)
Hi,
I did not understand why the following did not work out as I expected:
find . -name "pqp.txt" | grep -v "Permission"
I thought I would be able to catch whichever paths containing my pqp.txt file without receiving the display of messages such as "find: cannot access... Permisson... (1 Reply)
Hi All...
Does anyone know how to pipe the output of a "select" statement from a call to Oracle to a file?
ANy ideas woule be greatly appreciated!
Code is as below...
echo "producing CSV file 2..."
sqlplus -s $username/$password@$database<<EOF
set serveroutput on size 1000000
set... (13 Replies)
Hi.
I have a script like so:
#!/bin/bash
download='php /var/www/last.php'
echo $download
if $downloadHow do I pipe the output of the php file into a variable, as when i run the if statement, it just echos the file output to the screen and does not actually consider the output (it will be... (2 Replies)
Hi,
I have heard you can use the echo command and piping together and was wondering if you can help me out.
I want to be able to use the echo command and pipe together to tell me how many files are in my current working directory, which have only my username read, write and execute... (4 Replies)
Hi All,
I am trying to convert the below Csh code into Perl.
But i have the following error.
Can any expert help ?
Error:
ls: *tac: No such file or directory
Csh
set $ST_file = `ls -rt *$testid*st*|tail -1`;
Perl
my $ST_file = `ls -rt *$testid*st*|tail -1`; (10 Replies)
I am trying to have a script run without interaction from the command line. So in my script i have a line like this
echo -e "\n\n\ny\ny\n" | ./script
the goal being the ability to mimic 3 Enter presses and 2 'y/n' responses with 'y' followed by enter.
For some reason tho, it is not... (1 Reply)
Hi all. I am using procmail to deliver an email to a script I am developing. Procmail delivers the email to the script on standard input. I imagine this is the same as piping input from a command into the script. Hence I've been testing my script by running
echo 'test' | sms-autosend-backup.sh
... (2 Replies)
Ok, so there is a perl script that runs as a server, on my local host. It tells me which port to use. I want to pipe that output into my browser so I can do the whole thing with a single command. The problem is, I think, that the program doesn't actually exit cause it's running a server, so...... (6 Replies)
Basically I was wondering if any of you know how to pipe the output of ls to a text file? so in my shell script one of the lines is ls but i want to pipe it into a file called directory listing.
Cheers.
I have tried ls | Directorylisting.txt
but it keeps saying " line 7: DirectoryListing.txt:... (9 Replies)
Discussion started by: LinuxNubBrah
9 Replies
LEARN ABOUT PHP
php_strip_whitespace
PHP_STRIP_WHITESPACE(3) 1 PHP_STRIP_WHITESPACE(3)php_strip_whitespace - Return source with stripped comments and whitespaceSYNOPSIS
string php_strip_whitespace (string $filename)
DESCRIPTION
Returns the PHP source code in $filename with PHP comments and whitespace removed. This may be useful for determining the amount of actual
code in your scripts compared with the amount of comments. This is similar to using php -w from the commandline.
PARAMETERS
o $filename
- Path to the PHP file.
RETURN VALUES
The stripped source code will be returned on success, or an empty string on failure.
Note
This function works as described as of PHP 5.0.1. Before this it would only return an empty string. For more information on this
bug and its prior behavior, see bug report #29606.
EXAMPLES
Example #1
php_strip_whitespace(3) example
<?php
// PHP comment here
/*
* Another PHP comment
*/
echo php_strip_whitespace(__FILE__);
// Newlines are considered whitespace, and are removed too:
do_nothing();
?>
The above example will output:
<?php
echo php_strip_whitespace(__FILE__); do_nothing(); ?>
Notice the PHP comments are gone, as are the whitespace and newline after the first echo statement.
PHP Documentation Group PHP_STRIP_WHITESPACE(3)