Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 104215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:14:47+00:00 2026-05-11T01:14:47+00:00

I have this simple php script <?php echo ‘<pre>’; // Outputs all the result

  • 0

I have this simple php script

<?php echo '<pre>';  // Outputs all the result of shellcommand 'ls', and returns // the last output line into $last_line. Stores the return value // of the shell command in $retval. $last_line = $output = system ('~/public_html/cgi-bin/srch.sh &> ~/public_html/errors.txt',$retval);  // Printing additional info echo ' </pre> <hr />Last line of the output: ' . $last_line . ' <hr />Return value: ' . $retval; ?> 

Which relies on srch.sh:

#!/bin/bash  for i in ~/mail/home/user/mail/domain.com/josh/cur/* do grep -i Value $i . &> ~/public_html/yesno.txt; done 

However, all that is display in the b rowser is Retval 1, and no error gets recorded to either of the textfiles. Have I mixed stderr and stdout incorrectly, or missed something else?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:14:48+00:00Added an answer on May 11, 2026 at 1:14 am

    $last_line = $output = system ('~/public_html/cgi-bin/srch.sh &> ~/public_html/errors.txt',$retval);

    The above line runs srch.sh and redirects all the output it produces to errors.txt. Therefore, there is no output left to assign to $output (and $last_line). You’ll find your last line (together with the rest of the output) in errors.txt.

    If not, try running the shell script directly and see if it produces any output at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I am using Red-Gate's software: http://www.red-gate.com May 11, 2026 at 2:04 pm
  • added an answer Basically, to attach bitmap from the library you would do… May 11, 2026 at 2:04 pm
  • added an answer import os, random random.choice(os.listdir('C:\\')) #change dir name to whatever Regarding… May 11, 2026 at 2:04 pm

Related Questions

I have this simple php script <?php echo '<pre>'; // Outputs all the result
I have been writting a keyword search script based on this tutorial: http://www.hackosis.com/2007/11/06/howto-simple-search-engine-with-php-and-mysql/ Like
I have this simple regex, [\d]{1,5} that matches any integer between 0 and 99999.
I have this simple Jsp page: <%@ page language=java import=java.awt.Color%> <% Color background =
Say I have this simple form: class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True)
I'm trying to do a simple test php script for sessions. Basically it increments
On my site a number of operations can take a long time to complete.
I am teaching my friend how to make websites. I would like to keep
As a pet-project, I'd like to attempt to implement a basic language of my

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.