BASH Select - when in browser SELECT cmd sends output to Apche2 error.log

pizzipie

New Member
Joined
Sep 20, 2020
Messages
13
Reaction score
8
Credits
230
I can run pizdataRest.php which calls restoreBakup.sh which contains the subject "select" command from the command line in a terminal with no problems; it works!. Running the same from the "firefox" browser does not work!; the screen is blank except for the last line; "echo 'Continuing in 10 seconds.... "

After finding the below article on the internet I checked the /val/log/apache2/error.log and found that all the selections are there just as you want to find them on the screen.
.
.
60) /home/rick/DBases2/MySql-bakups/2020Sep18-13:31:43_pizzidata.sql
61) /home/rick/DBases2/MySql-bakups/2020Sep18-13:31:43_polly.sql.gz
62) /home/rick/DBases2/MySql-bakups/2020Sep18-13:31:43_rick.sql.gz
63) /home/rick/DBases2/MySql-bakups/2020Sep18-13:31:43_sagle.sql.gz
64) /home/rick/DBases2/MySql-bakups/2020Sep18-13:31:44_states.sql.gz
65) /home/rick/DBases2/MySql-bakups/2020Sep18-13:31:44_taxins.sql.gz
.
.

Can this problem be fixed somehow??

Thanks in advance for your help.

FROM
Linux Tutorials - Learn Linux Configuration

How to create a selection menu using the select statement in Bash shell

........ The words obtained from the expansion of the variable are printed on the stderr (standard error). Each one is preceded and associated with a number, which is what the user will use to reference it. After all the elements are displayed, the user is prompted to enter its choice. What is displayed is the PS3 prompt ....

Code:
<?php

//Wed Nov 11, 2020 15:42
// File - pizdataRest.php
header( "refresh:10; url=PizziFrontEnd.php" );

exec("./restoreBakup.sh user passwd ", $output, $return_var);

print_r($output);
echo $return_var;

echo 'Continuing in 10 seconds. Return now - click<a href="PizziFrontEnd.php"> here</a>.';

?>

Code:
#!/bin/bash

  # File - restoreBakup.sh
  #Sun 24 Sep 2017 18:23:28
  #Tue 13 Oct 2020 09:18:45
  #Sun 08 Nov 2020 14:15

  # This is the companion script to dbaseBakup.sh
  # restoreBackup.sh  will restore the files dumped by that program

#folder="/home/rick/DBases/MySql_bakups"
folder="/home/rick/DBases2/MySql-bakups"

user=$1      # command line parameters
passwd=$2

   echo "-- Start"
   echo

  PS3='Pick a Database to Restore ...  '

    select bakup in $(ls -d "$folder"/* )
    do
       break;
    done

ext=$(echo $bakup | awk -F "." '{print $2, $3}') # $2 gets sql - $3 gets gz extension
.
.
.
.
.
--- DONE ---
 
Last edited:

Staff online

Members online


Latest posts

Top