![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| perl + array and incrementing number | Optimus_P | Shell Programming and Scripting | 5 | 07-18-2008 03:55 AM |
| Port num incrementing | coolkid | Shell Programming and Scripting | 5 | 05-28-2008 06:51 PM |
| shell script help: sorting, incrementing environment variables and stuff | secoif | Shell Programming and Scripting | 1 | 05-08-2008 08:04 AM |
| New iteration of for-loop without incrementing? | jeriryan87 | Shell Programming and Scripting | 0 | 07-02-2007 03:13 PM |
| incrementing a for loop | run_time_error | Shell Programming and Scripting | 2 | 03-28-2005 03:45 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Port incrementing using one file
Hi
I wrote this script with the help of you guyz.My next challenge is to increment the port using single file.So far iam using this code to increment hp1 and hp2 .To increment port numbers, iam using two different files (.default_port_hp1 and .default_port_hp2).The challenge for me is to use single file and increment the ports. ------------- echo -n "Enter hp1 port: " read hp1 if [ -z $hp1 ] then default_port_file=.default_port_hp1 default_port_value=80 get_default_port() { if [ -f $default_port_file ] then default_port=$(<$default_port_file) else default_port=$default_port_value fi } set_default_port() { if [[ $1 > ${default_port:-$default_port_value} ]] then echo $1 > $default_port_file fi } get_default_port echo "---Using [$default_port] as default port-- : " read hp1 hp1=${hp1:-$default_port} echo "Port number used = $hp1" set_default_port $((hp1+1)) fi -- echo -n "Enter hp2 port: " read hp2 if [ -z $hp2 ] then default_port_file=.default_port_hp2 default_port_value=443 get_default_port() { if [ -f $default_port_file ] then default_port=$(<$default_port_file) else default_port=$default_port_value fi } set_default_port() { if [[ $1 > ${default_port:-$default_port_value} ]] then echo $1 > $default_port_file fi } get_default_port echo "---Using [$default_port] as default port-- : " read https_port hp2=${hp2:-$default_port} echo "Port number used = $hp2" set_default_port $((hp2+1)) fi ---------------- Appreciate your help guyz --Cool |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|