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

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

by
pizzipie
from LinuxQuestions.org on (#5AAEZ)
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.logand found that all the selections are there just as you want to find them on the screen.
Quote:
.
.
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
.
.
Can this problem be fixed somehow??

Thanks in advance for your help.

R

Quote:
FROM https://linuxconfig.org/

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 ---latest?d=yIl2AUoC8zA latest?i=QsTwvBDCdwg:0-mKXrIh8vg:F7zBnMy latest?i=QsTwvBDCdwg:0-mKXrIh8vg:V_sGLiP latest?d=qj6IDK7rITs latest?i=QsTwvBDCdwg:0-mKXrIh8vg:gIN9vFwQsTwvBDCdwg
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments