Programming :: Combine CGI Script With A Bash Script ?

Feb 9, 2010

I have a fallowing CGI script, which does nothing more than prints out the values user inserted:

Code:

If I insert Martin to the name box and 192.168.1.1 to the IP box I get fallowing output:

Quote:

Name is Martin

IP address is 192.168.1.1

As you can see, script above works fine(I host this script in Apache server and use Firefox as a web-client). Now I made a fallowing bash script:

Code:

Which is started like this: ./script.sh Martin 192.168.1.1. Output is user name plus port numbers and descriptions. This bash script works fine as well

How can I combine those two scripts? I would like to insert name and IP to according boxes in Firefox and after clicking Generate button, user name plus list of port numbers and descriptions will appear in Firefox window instead of terminal emulator window

How to link/combine those two scripts to work together as one?

View 2 Replies


ADVERTISEMENT

Programming :: Bash: Combine Arrays & Delete Duplicates?

May 23, 2011

I would like to combine two arrays and delete duplicates that might occur. I tried to solve it like this:

Code:
combined=( "${results1[@]}" "${results2[@]}" )
printf "${combined[@]}" | sort -n | uniq
Example:
result1 (4 elements):

[Code]....

In my code printf seems to have a problem with elements that have the same letters but a space inbetween. For instance "new foo", "newfoo" are the same for printf

View 5 Replies View Related

Ubuntu :: Bash Script - Combine The Variable

Jul 23, 2011

Code:
#!/bin/bash
f1=apple
f2=banana
f3=grape
echo "Enter number 1,2 or 3:" # 3 is entered
read x
choice=${f+$x} # yielding choice=$f3
echo "$choice" # so $choice is, essentially, read as f3, which = grape

grape I am, essentially, trying to combine "f" and the number entered (3, for example) to create "f3", which when echoed as "$choice" will lead to grape!

View 8 Replies View Related

General :: Combine Bash Scripting With Apache?

Apr 3, 2011

how to combine bash scripting with apache.

View 5 Replies View Related

Fedora :: Bash Script - Combine Files So That The File Output Is PORT.80 TCP SRC=x.x.x.x United States

Oct 31, 2010

I am working on a script that allows me to convert an IP address to a country name. I have 2 files. One that has text like: PORT.80 TCP SRC=x.x.x.x and the other is x.x.x.x United States. How can I combine these files so that the file output is PORT.80 TCP SRC=x.x.x.x United States?

View 5 Replies View Related

Programming :: How To Combine A And B To C

May 12, 2010

Code...

how to combine a and b to c

View 8 Replies View Related

Programming :: How To Combine ASM And C Code

Apr 10, 2010

I have a little test program consisting of a NASM source file and a C source file.How do I turn them into a single program?

Code:
section .data
msg db 'Hello, World!', 10

[code]....

View 14 Replies View Related

Programming :: Condense And Combine Two Log Files?

Jun 8, 2011

My backup script generates 2 lengthy log file. They have the same name, but the date is appended. I want to select the oldest one, condense it with "head" and "tail" and then append the condensed version of the newer one. They seem to get tangled up.Code:

ls `find . -iname "bak-log_*"` -1t | tail -1
and
ls `find . -iname "bak-log_*"` -rt | tail -1

[code]...

View 2 Replies View Related

Programming :: Korn - Combine Select With An Array?

Jun 8, 2010

Assume this array in Korn:

Code:
HOSTS[ home ]="163.164.165.166"
HOSTS[ work ]="122.123.124.125"

[code]....

View 3 Replies View Related

Programming :: Combine 40 Different Mount Points Into One Bytes Free/used Number?

Feb 18, 2011

We have a program that catalogs to 40 different mount points. The program is fine as long as thier is free space on at least one of the 40 mount points. My boss wants me to come up with a script that will email us daily to know how much overall free space is left. I know I can do a df but I don't know how to combine the 40 mount points into a single disk used/disk free report.

The 40 mount points are /dev/mapper/areaxx, xx being 01 to 40.

View 4 Replies View Related

Programming :: Shell Scripting: Trying To Combine Upload And Download Totals From Txt File By Ip Add

Sep 6, 2010

I have two files, uploads.txt and downloads.txt. I would like to combine the columns of these files based on the ip address. How can I best do this?

Uploads.txt Code: 192.168.0.147 1565369
192.168.0.13 1664855
192.168.0.6 1332868 Downloads.txt Code: 192.168.0.147 9838820

[code]...

View 7 Replies View Related

Programming :: Finding A Utility To Combine Two Or More Binary Files Into A Single Binary File?

May 5, 2011

Is there any Linux utility to combine two or more binary files into a single binary file ?

View 7 Replies View Related

Programming :: Bash: Printing The Line Number In Bash Script?

Feb 4, 2011

I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.

View 3 Replies View Related

Programming :: Bash Ctrl+c Tarp And Bash Read With Timeout?

Jan 24, 2010

simple bash code:

Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do

[Code]...

How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!

View 10 Replies View Related

Programming :: Reading A Bash Variable In Bash Scripting ?

Nov 26, 2008

I have a config file that contains:

my.config:

Code:

Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.

Here is my parse_cmd script:

Code:

View 3 Replies View Related

Programming :: Run Multiple Bash And Php Scripts From A Bash Script?

Jul 25, 2011

I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.

Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?

View 5 Replies View Related

Programming :: Bash: Get Filename And Extension Using Bash?

Jan 9, 2010

I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:

Let FILE="thefilenameofsomefilesfor_instance.txt"

Code:

NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`

I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.

View 5 Replies View Related

Programming :: Bash Programming - Rename Files In A Loop?

Mar 31, 2011

I need to rename the resulted searched files from a loopI have the following code:

find . -name DOC* | while read i
do
find $i -type f -name '*.txt'
done

basically, I am searching for all txt files inside any folder starting with DOC name.this code is working fine with me.I need to rename those .txt files to .txtOLDOS: Ubuntu 10.4Bash shell

View 10 Replies View Related

Programming :: Write A Bash Script That Sources Another Bash Script?

Jan 29, 2011

I am trying to write a bash script that sources another bash script. Essentially, I need a few lines to check to see if a certain variable is set. If not, I set it manually, and then source a scripts with that variable in the path. I wrote a test script to try it, but for some reason the last line does not work. Here is what I wrote:

#!/bin/sh
source ~setupdir/setup.shrc #just a test, this line works
echo ${#SETUP} # prints 0 if setup is not set, which it isn't
if [ ${#SETUP} -eq 0 ]
then
SETUP="~setupdir"
fi
echo $SETUP # prints ~setupdir

[Code]...

View 5 Replies View Related

Programming :: Bash Scripting To Programming?

Jul 13, 2011

i'm in the process of learing C++. currently i'm creating shell scripts to get things done. i'm just curious how, as a programmer using C++ you would get a similar job done.as an example i have a script that takes the contents of files, pipes it to some sed and awk commands, which is piped to create a new file. that file is then imported into a mysql database.if you were going to do this in C++, would you call the sed/awk programs to modify the file, or can it be done within the program itself? i'm probably jumping the gun here because i've just started learing about pointers so this is above my ability

View 12 Replies View Related

Programming :: Sed A Variable In Bash?

Mar 25, 2011

I have beat this enough and don't get what should have been a very simple thing to do. I build a variable;

Code:
CLIST=java,lua,python,php,perl,ruby,tcl
CLIST will be used by another bash script but I need to replace the commas with a space. I

[code]...

View 2 Replies View Related

Programming :: Bash Script HELP - Hex To Dec ?

Dec 4, 2010

Creating script that converts hex to dec. But without using bc calculator or other methods that could convert it in one line. I need to make something like this script that converts dec to hex.

View 1 Replies View Related

Programming :: Can Use Bash Within An Awk Script

Apr 14, 2011

I have a basic awk script that can read a file named 'server_info' and output to the screen which fax lines are not working. Now I want to make the script execute commands instead of printing to the screen but I am having trouble... This is better explained by my code below:

test.sh Code: #!/usr/bin/awk -f
#
#The name of this script is test.sh

[code]....

View 1 Replies View Related

Programming :: Bash Command From PHP?

Jul 14, 2011

Distro: Centos 5, PHP 5I have done a bit research on running bash commands from php and there was little success. This is my relevant php script

<?php
echo exec('pwd');
?>

[code]...

View 16 Replies View Related

Programming :: Bash Function Using If / Then And Else

May 2, 2011

I am trying to build a function inside a script.

Code:
#!/bin/sh
#System commands and other configurable.
IPT=/sbin/iptables
IP6T=/sbin/ip6tables
IPST=/usr/sbin/ipset
MODP=/sbin/modprobe
GET=/usr/bin/wget
INT_NET=192.168.1.0/24 .....

I can find lots of tutorials in how to use if, then, else. However, how do I define a variable inside the function?
SEE>>
Code:
for c in $ISO
Also, am I using the 'test' command correctly( -/+ week as valid test)?

View 7 Replies View Related

Programming :: Bash IF Using IP Subnets?

Feb 14, 2011

I'm somewhere between Novice and I have no idea what I'm doing with bash scripts. I'm writing a script to deploy images using partimage on my company's desktops, and while I have just about everything else figured out I have one issue left.Each of our 4 sites that will be using this disc will have a deployment server due to the fact that our sites have dedicated point to point links that our business traffic is conducted on. I need to be able to determine what site I'm at based onubnet and set a variable based on this determination. What I don't know is how to get the IP address in to an if statement, and properly determine subnet. For example:

192.168.1.0/16 - 192.168.7.0/16 need to use DEPLSERV01
192.168.8.0/16 - 192.168.16.0/16 use DEPLSERV02
192.168.17.0/16 - 192.168.24.0/16 use DEPLSERV03

View 1 Replies View Related

Programming :: Difference Between /bin/bash And /bin/sh?

Dec 27, 2008

I know it's a very silly question but could someone please explain the difference between "/bin/bash" & "/bin/sh" I was under the impression that both are same but following output on my Ubuntu 8.10 is making me raise my eyebrows.

Quote:

parag@station3:~$ ls -l /bin/bash ; ls -l /bin/sh
-rwxr-xr-x 1 root root 725136 2008-05-13 00:18 /bin/bash
lrwxrwxrwx 1 root root 4 2008-12-03 21:42 /bin/sh -> dash
parag@station3:~$

View 11 Replies View Related

Programming :: Run Bash Script On Web?

Apr 9, 2010

i want to run bash script on website.i still have to choose between unix hosting and windows hosting. my web hosting service offer Own Cgi - Bin PHP,ASP,MYSQL,MSSQL, and script schedule(cronejob). This is script

#!/bin/bash
#Store arguments from bash command line
fight=$1
support=$2
msg=rmsg

[Code]....

View 2 Replies View Related

Programming :: Using Eval In Bash?

Nov 23, 2010

Having a problem with an unwanted redirection in in a function call. Although this isn't the function it does illustrate the problem:

Code:
#!/bin/bash
doat () {
ALL="sys1 sys2"
for Sys in $ALL;do
echo "---> $Sys <---";
echo $(eval echo $1);

[Code]...

figure out how to get the variable into the command without outputting to the file in the eval statement? So that ssh line that gets executed would look like the following to each iteration of the for loop:

Code:
ssh root@$Sys rpm -qa|sort > /trans/${Sys}-rpm-list.txt;
doat works when the incoming argument doesn't have any redirection in the command.

View 3 Replies View Related

Programming :: Using Gambas With Bash?

Jun 8, 2010

Is it possible to use Gambas as a GUI to read text string variables that are input by a user, and use the variables in a bash command?

I know how to do this simply with bash, but I want a GUI that little kids can easily use.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved