summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-04-30 00:51:48 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-04-30 00:51:48 +0000
commit40a1b7af9051e7d8bb9525f4a64ea966a97e3ef1 (patch)
treeca51acc501864907812e655e146e6c6dd1229a56
parent123bfdac651e29eacc255f0079cf8326bc26788a (diff)
downloadpfsense-40a1b7af9051e7d8bb9525f4a64ea966a97e3ef1.zip
pfsense-40a1b7af9051e7d8bb9525f4a64ea966a97e3ef1.tar.gz
Add multiline support for multi-line mini programs/scripts.
-rwxr-xr-xusr/local/sbin/pfSsh.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/usr/local/sbin/pfSsh.php b/usr/local/sbin/pfSsh.php
index 105c4d9..885e38e 100755
--- a/usr/local/sbin/pfSsh.php
+++ b/usr/local/sbin/pfSsh.php
@@ -23,7 +23,8 @@ echo "Example commands:\n\n";
echo " print_r(\$config);\n";
echo " \$config['interfaces']['lan']['ipaddr'] = \"192.168.1.1\";\n";
echo " write_config();\n";
-echo " exit\n";
+echo " multiline\n";
+echo " exit";
while($shell_active == true) {
echo "\n\npfSense shell> ";
@@ -33,5 +34,24 @@ while($shell_active == true) {
echo "\n";
break;
}
- eval($command);
+ if($command == "multiline" or $command == "ml") {
+ echo "\nmultiline mode enabled. enter EOF on a blank line to execute.\n\n";
+ $command = "";
+ $mlcommand = "";
+ $xxxyzyz = 0;
+ while($command <> "EOF") {
+ echo "pfSense multiline shell[$xxxyzyz]> ";
+ $command = chop(fgets($fp));
+ if($command == "exit")
+ die;
+ if($command <> "EOF")
+ $mlcommand .= $command;
+ $xxxyzyz++;
+ }
+ $command = $mlcommand;
+ }
+ if($command) {
+ echo "\n";
+ eval($command);
+ }
}
OpenPOWER on IntegriCloud