在Bash脚本命令的输出到下拉框? [英] Output of command in Bash script to Drop-down box?

查看:247
本文介绍了在Bash脚本命令的输出到下拉框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,在回答这个问题之前我AP preciate任何和所有帮助。
我有一个bash脚本的命令将输出以下内容:

First off, I appreciate any and all help in answering this question. I have a command in a bash script that will output the following:

255 254 253 252 ... 7 6 5 4 3 2 1 

有数字的具体名单,其中最大的开始(这是我想什么),然后去到最小。该数据集是空间分隔的。上面的输出(除包括所有数字),是你会看到,如果你运行在Linux计算机上在终端命令,或通过bash脚本。

It is a specific list of numbers, beginning with the largest (which is what I would like), then going to the smallest. The dataset is space-delimited. The output above (except including all numbers), is what you would see if you ran this command in the terminal on a linux machine, or through a bash script.

我已经配置我的Apache2服务器允许通过cgi-bin目录的CGI / bash的。当我运行在从网上一个bash文件,此命令时,我得到预期的输出。

I have configured my apache2 server to allow for cgi/bash through the cgi-bin directory. When I run this command in a bash file from the web, I get the expected output.

我正在寻找一种方法,是能够把每一个这些数字作为供选择下拉框中选择一个单独的条目,这意味着用户可以选择一个数据点(254为例)从下拉菜单。

What I'm looking for is for a way to be able to put these numbers each as a separate entry in a drop-down box for selection, meaning the user can select one point of data (254, for example) from the drop down menu.

我不知道我这个做的,所以任何帮助将是AP preciated。我不知道如果我需要将数据转换成一个数组,或者是什么。下拉菜单可以是bash脚本的同一页面上,但无论是什么,它​​必须更新每次运行时它是从命令编号列表。

I'm not sure what I'm doing with this, so any help would be appreciated. I'm not sure if I need to convert the data into an array, or what. The drop down menu can be on the same page of the bash script, but wherever it is, it has to update it's list of numbers from the command every time it is run.

感谢您的帮助。

推荐答案

我总是发现这个网站有用的shell脚本时摆弄:的 http://tldp.org/LDP/abs/html/

I've always found this site useful when fiddling with shell scripts: http://tldp.org/LDP/abs/html/

你必须使用某种字符串操作使用空格作为分隔符,然后在该循​​环建立一些HTML输出,让您的输出到一个数组 - 所以在页面上的返回值将基本上只是输出您的选择框在这里你执行你的CGI / bash脚本。

you'll have to get your output into an array using some sort of string manipulation using the spaces as delimiters, then loop over that to build some html output - so the return value will basically just output your select box on the page where you execute your cgi/bash script.

-Sean

这篇关于在Bash脚本命令的输出到下拉框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆