Option 4 in script broken


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Option 4 in script broken
# 1  
Old 08-10-2010
Option 4 in script broken

Hi,

I need some help with an issue on my script. When I run option 3 it works just fine.
When I run Option 4 which puts back the changes done in option 3 it fails. Oddly enough when I run Option 4 right after it failed it seems to work. I am not sure why that is or is a false positive.

In short, the script references an input file hosts_lists.txt when contains two blocks of IP addresses

Column 1 - Production server_1
Column 2 - Disaster Recover dr_server_1 (failover system)

192.168.5.100 192.168.6.200
192.168.5.101 192.168.6.201

It adds an 'x' to the real name then adds the real name as an alias to the DR name from column 2.

Then when the test is over its supposed to remove the alias from the DR name and take out the 'X' from the production name, basically put it all back.

Could someone please see why option 4 is not doing this right, and why if I run option 4 for the second time it seems to work.

If its easier, could someone perhaps loop section 4 so it runs 2x and suppress the error echo.

Thank you

Code:
#!/bin/bash
#########################################################################
#                                                                       #
# Input file to contain list of all Critical Servers with Corresponding #
# DR Servers in 2 columns eg. ip addresses only                         #
#                                                                       #
# Column 1 - Production server_1                                        #
# Column 2 - Disaster Recover dr_server_1 (failover system)             #
#                                                                       #
# 192.168.5.100 192.168.6.200                                           #
# 192.168.5.101 192.168.6.201                                           #
#                                                                       #
#                                                                       #
#########################################################################

. /opt/qip/etc/qiprc         # Source QIP Variables
. /opt/sybase/SYBASE.sh
#
# Variables Used
#
In_File="/home/ammuser/rich-DR/host_list.txt"        # Input with above layout
Temp_Dir="/home/ammuser/rich-DR/tmp/`date +%m_%d_%y`"    # Obect profile directory
Mod_Dir="${Temp_Dir}/modified"                 # Modified Object Profile directory
Host=1
Dns_Server="qipdrpinfs001.rich.com.au" # Primary DNS Server
#
# Main Loop
#
while : {
do
clear
echo ""
#[ -f ${In_File} ] && echo "Current Input file :- ${In_File}"
#[ -d ${Temp_Dir} ] && echo "Current Object Dir :- ${Temp_Dir}"
echo "==========================================================="
echo "Current Input file :- ${In_File}"
echo "Current Object Dir :- ${Temp_Dir}"
echo "==========================================================="
echo "DNS-DR Host processing - rich"
echo "---------------------------------------------"
#echo "Switch to DR Mode ................1"
#echo "Switch to PROD Mode ..............2"
echo "Process DR hosts file .............3"
echo "Rollback to Orig. objects .........4"
echo "Update Primary DNS qipdrpinfs001...5"
echo "Quit...............................q"
echo "---------------------------------"
echo "Please make a selection:"
read ans
case ${ans} in
   1)
     echo "Switching to DR mode ..."
     sleep 1
     echo "Starting DR QIP Database ..."
     $QIPHOME/n3k-scripts/online_database.sh
     sleep 5
     echo "Updating /etc/init.d/rc.qip symlink for DR startup ..."
     rm /etc/init.d/rc.qip
     ln -s /etc/init.d/rc.qip.dr /etc/init.d/rc.qip
     echo "Activating DR qip.pcy file ..."
     sleep 1
     rm $QIPHOME/qip.pcy
     ln -s $QIPHOME/qip.pcy.dr $QIPHOME/qip.pcy
     echo "Restarting QIP processes ..."
     sleep 1
     /etc/init.d/rc.qip stop
     /etc/init.d/rc.qip start
     echo "\n... done .\n"
     echo "Press any key to continue .\c"
     read dummy
     ;;
   2)
     echo "Switching to PROD mode ..."
     sleep 1
     echo "Updating /etc/init.d/rc.qip symlink for normal startup ..."
     sleep 1
     rm /etc/init.d/rc.qip
     ln -s /etc/init.d/rc.qip.standard /etc/init.d/rc.qip
     echo "Reinstating standard qip.pcy file ..."
     rm $QIPHOME/qip.pcy
     ln -s $QIPHOME/qip.pcy.standard $QIPHOME/qip.pcy
     echo "Restarting QIP processes ..."
     sleep 1
     /etc/init.d/rc.qip stop
     /etc/init.d/rc.qip start
     echo "\n... done .\n"
     echo "Press any key to continue .\c"
     read dummy
     ;;
  3)
    [ -f ${In_File} ] || echo "Input file :- ${In_File} does not exist !!!"
    if [ -d ${Temp_Dir} ]
    then
    {
    echo "Destination Object Directory already Exist "
    echo "Are you sure you want to continue (y/n) ..."
    read a
        if [ "$a" = "y" ]
        then
        {
        echo "Backing up old dir ...."
        mv ${Temp_Dir} "${Temp_Dir}.`date +%T`" # Remove old directory
        #
        # Make Directories if does not exist
        #
        [ ! -d "${Temp_Dir}" ] && /bin/mkdir "${Temp_Dir}"
        [ ! -d "${Mod_Dir}" ] && /bin/mkdir "${Mod_Dir}"
        #
        ###################################################################
        # Validate if the object exist in QIP
        # and create QIP Object Profile files for production and DR Object
        ###################################################################
        #
        ###################################################################
        # Validate if the object exist in QIP
        # and create QIP Object Profile files for production and DR Object
        ###################################################################
        #
        while read a b
        do
           qip-getobjectprof -u qipman -p qipman -s QIPSYBASE -a $a -f ${Temp_Dir}/${Host}.a.txt
           qip-getobjectprof -u qipman -p qipman -s QIPSYBASE -a $b -f ${Temp_Dir}/${Host}.b.txt
           Host=`expr $Host + 1`
        done < ${In_File}
        #
        #
        cd ${Temp_Dir}
        #
        ###################################################################
        # Manipulate the file s created above essentially renaming the
        # Production Object and creating an Alias for Prod Name to point
        # to Disaster Recovery Object
        ###################################################################
        #
        for i in `ls *.a.txt`
        do
                #
                # Store the Host name before we make changes to object profile
                # to later use as Alias to DR object
                #
           H_alias=`cat $i |grep ObjectName |awk -F= '{print $2}'`
                #
                # Append ObjectName with "x" to avoid name conflicts.
                #
           sed -e 's/^ObjectName.*/&x/' $i > ${Mod_Dir}/$i
                #
                # Work out corresponding file to the Changed Production Object
                #
           DR_File=`echo $i|awk -F. '{print $1".b."$3}'`
                #
                # Modify the matching DR Object files with Alias Entries
                #
           sed -e "s/^Aliases.*/& $H_alias/" $DR_File > $Mod_Dir/$DR_File
        done
                #
                # Commit changes to Database
                #
        cd $Mod_Dir
        for j in `ls`
        do
           qip-setobject -u qipman -p qipman -s QIPSYBASE -t $j
           echo "Setting $j ..."
        done
        }
        fi
     }
     else
     {
        #
        # Make Directories if does not exist
        #
        [ ! -d "${Temp-Dir}" ] && /bin/mkdir "${Temp_Dir}"
        [ ! -d "${Mod_Dir}" ] && /bin/mkdir "${Mod_Dir}"
        #
        ###################################################################
        # Validate if the object exist in QIP
        # and create QIP Object Profile files for production and DR Object
        ###################################################################
        #
        while read a b
        do
           qip-getobjectprof -u qipman -p qipman -s QIPSYBASE -a $a -f ${Temp_Dir}/${Host}.a.txt
           qip-getobjectprof -u qipman -p qipman -s QIPSYBASE -a $b -f ${Temp_Dir}/${Host}.b.txt
           Host=`expr $Host + 1`
        done < ${In_File}
        #
        #
        cd ${Temp_Dir}
        #
        ###################################################################
        # Manipulate the file s created above essentially renaming the
        # Production Object and creating an Alias for Prod Name to point
        # to Disaster Recovery Object
        ###################################################################
        #
        for i in `ls *.a.txt`
        do
                #
                # Store the Host name before we make changes to object profile
                # to later use as Alias to DR object
                #
           H_alias=`cat $i |grep ObjectName |awk -F= '{print $2}'`
                #
                # Append ObjectName with "x" to avoid name conflicts.
                #
           sed -e 's/^ObjectName.*/&x/' $i > ${Mod_Dir}/$i
                #
                # Work out corresponding file to the Changed Production Object
                #
           DR_File=`echo $i|awk -F. '{print $1".b."$3}'`
                #
                # Modify the matching DR Object files with Alias Entries
                #
           sed -e "s/^Aliases.*/& $H_alias/" $DR_File > $Mod_Dir/$DR_File
        done
                #
                # Commit changes to Database
                #
        cd $Mod_Dir
        for j in `ls`
        do
           qip-setobject -u qipman -p qipman -s QIPSYBASE -d $j
           echo "Setting $j ..."
        done
     }
     fi
     sleep 2
     ;;
   4)
      echo "Select a different Object source Directory (y/N)..."
      read bb
        if [ "$bb" = "y" ]
        then
        {
          echo "Please Enter new Object Directory ..."
          read dir
          if [ -d "$dir" ]
          then
          {
            Temp_Dir="$dir"
            echo "Rolling back objects to Original properties ..."
            cd ${Temp_Dir}
            for x in `ls *txt`
             do
               qip-setobject -u qipman -p qipman -s QIPSYBASE -t $x
               echo "Setting $x ...\n"
             done
          }
          else
          {
          echo "Invalid Directory specified ..."
          sleep 2
          }
          fi
        }
        else
        {
          echo "Rolling back objects to Original properties ..."
          cd ${Temp_Dir}
          for x in `ls *txt`
           do
             qip-setobject -u qipman -p qipman -s QIPSYBASE -d $x
             echo "Setting $x ..."
           done
        }
        fi
     ;;
   5)
     echo "Updating DNS Server ${Dns_Server} .."
     qip-dnsupdate -u qipman -p qipman -s QIPSYBASE -n ${Dns_Server}
     echo "... done."
     echo "Press any key to continue ."
     read dummy
     ;;
   q|Q)
     exit 0
     ;;
   *)
     echo "Invalid Selection ..."
     sleep 2
     ;;
esac
done

Script in debug mode:

Code:
Option 3:

+ In_File=/home/ammuser/rich-DR/host_list.txt
++ date +%m_%d_%y
+ Temp_Dir=/home/ammuser/rich-DR/tmp/08_08_10
+ Mod_Dir=/home/ammuser/rich-DR/tmp/08_08_10/modified
+ Host=1
+ Dns_Server=qipdrpinfs001.rich.com.au
+ : '{'
+ clear

+ echo ''

+ '[' -d /home/ammuser/rich-DR/tmp/08_08_10 ']'
+ echo ===========================================================
===========================================================
+ echo 'Current Input file :- /home/ammuser/rich-DR/host_list.txt'
Current Input file :- /home/ammuser/rich-DR/host_list.txt
+ echo 'Current Object Dir :- /home/ammuser/rich-DR/tmp/08_08_10'
Current Object Dir :- /home/ammuser/rich-DR/tmp/08_08_10
+ echo ===========================================================
===========================================================
+ echo 'DNS-DR Host processing - rich'
DNS-DR Host processing - rich
+ echo ---------------------------------------------
---------------------------------------------
+ echo 'Process DR hosts file .............3'
Process DR hosts file .............3
+ echo 'Rollback to Orig. objects .........4'
Rollback to Orig. objects .........4
+ echo 'Update Primary DNS qipdrpinfs001...5'
Update Primary DNS qipdrpinfs001...5
+ echo Quit...............................q
Quit...............................q
+ echo ---------------------------------
---------------------------------
+ echo 'Please make a selection:'
Please make a selection:
+ read ans
3
+ case ${ans} in
+ '[' -f /home/ammuser/rich-DR/host_list.txt ']'
+ '[' -d /home/ammuser/rich-DR/tmp/08_08_10 ']'
+ '[' '!' -d Dir ']'
+ /bin/mkdir /home/ammuser/rich-DR/tmp/08_08_10
+ '[' '!' -d /home/ammuser/rich-DR/tmp/08_08_10/modified ']'
+ /bin/mkdir /home/ammuser/rich-DR/tmp/08_08_10/modified
+ read a b
+ qip-getobjectprof -u qipman -p qipman -s QIPSYBASE -a 10.0.0.1 -f /home/ammuser/rich-DR/tmp/08_08_10/1.a.txt
+ qip-getobjectprof -u qipman -p qipman -s QIPSYBASE -a 10.0.0.2 -f /home/ammuser/rich-DR/tmp/08_08_10/1.b.txt
++ expr 1 + 1
+ Host=2
+ read a b
+ cd /home/ammuser/rich-DR/tmp/08_08_10
++ ls 1.a.txt
+ for i in '`ls *.a.txt`'
++ cat 1.a.txt
++ grep ObjectName
++ awk -F= '{print $2}'
+ H_alias=real-prod
+ sed -e 's/^ObjectName.*/&x/' 1.a.txt
++ echo 1.a.txt
++ awk -F. '{print $1".b."$3}'
+ DR_File=1.b.txt
+ sed -e 's/^Aliases.*/& real-prod/' 1.b.txt
+ cd /home/ammuser/rich-DR/tmp/08_08_10/modified
++ ls
+ for j in '`ls`'
+ qip-setobject -u qipman -p qipman -s QIPSYBASE -d 1.a.txt
+ echo 'Setting 1.a.txt ...'
Setting 1.a.txt ...
+ for j in '`ls`'
+ qip-setobject -u qipman -p qipman -s QIPSYBASE -d 1.b.txt
+ echo 'Setting 1.b.txt ...'
Setting 1.b.txt ...
+ sleep 2
+ : '{'
+ clear

+ echo ''

+ '[' -d /home/ammuser/rich-DR/tmp/08_08_10 ']'
+ echo 'Current Object Dir :- /home/ammuser/rich-DR/tmp/08_08_10'
Current Object Dir :- /home/ammuser/rich-DR/tmp/08_08_10


========================

Option 4 Run once:

+ echo ===========================================================
===========================================================
+ echo 'Current Input file :- /home/ammuser/rich-DR/host_list.txt'
Current Input file :- /home/ammuser/rich-DR/host_list.txt
+ echo 'Current Object Dir :- /home/ammuser/rich-DR/tmp/08_08_10'
Current Object Dir :- /home/ammuser/rich-DR/tmp/08_08_10
+ echo ===========================================================
===========================================================
+ echo 'DNS-DR Host processing - rich'
DNS-DR Host processing - rich
+ echo ---------------------------------------------
---------------------------------------------
+ echo 'Process DR hosts file .............3'
Process DR hosts file .............3
+ echo 'Rollback to Orig. objects .........4'
Rollback to Orig. objects .........4
+ echo 'Update Primary DNS qipdrpinfs001...5'
Update Primary DNS qipdrpinfs001...5
+ echo Quit...............................q
Quit...............................q
+ echo ---------------------------------
---------------------------------
+ echo 'Please make a selection:'
Please make a selection:
+ read ans
4
+ case ${ans} in
+ echo 'Select a different Object source Directory (y/N)...'
Select a different Object source Directory (y/N)...
+ read bb
n
+ '[' n = y ']'
+ echo 'Rolling back objects to Original properties ...'
Rolling back objects to Original properties ...
+ cd /home/ammuser/rich-DR/tmp/08_08_10
++ ls 1.a.txt 1.b.txt
+ for x in '`ls *txt`'
+ qip-setobject -u qipman -p qipman -s QIPSYBASE -d 1.a.txt
Object [ real-prod.rich.com.au ] collides with a V4Object name alias.
Update failed on 10.0.0.1
qip-setobject ::  Error code = 524
+ echo 'Setting 1.a.txt ...'
Setting 1.a.txt ...
+ for x in '`ls *txt`'
+ qip-setobject -u qipman -p qipman -s QIPSYBASE -d 1.b.txt
+ echo 'Setting 1.b.txt ...'
Setting 1.b.txt ...
+ : '{'
+ clear


=================================

Run Option 4 for the second time, seems to work. I dont know why?? would like to fix that.


---------------------------------------------
+ echo 'Process DR hosts file .............3'
Process DR hosts file .............3
+ echo 'Rollback to Orig. objects .........4'
Rollback to Orig. objects .........4
+ echo 'Update Primary DNS qipdrpinfs001...5'
Update Primary DNS qipdrpinfs001...5
+ echo Quit...............................q
Quit...............................q
+ echo ---------------------------------
---------------------------------
+ echo 'Please make a selection:'
Please make a selection:
+ read ans
4
+ case ${ans} in
+ echo 'Select a different Object source Directory (y/N)...'
Select a different Object source Directory (y/N)...
+ read bb
n
+ '[' n = y ']'
+ echo 'Rolling back objects to Original properties ...'
Rolling back objects to Original properties ...
+ cd /home/ammuser/rich-DR/tmp/08_08_10
++ ls 1.a.txt 1.b.txt
+ for x in '`ls *txt`'
+ qip-setobject -u qipman -p qipman -s QIPSYBASE -d 1.a.txt
+ echo 'Setting 1.a.txt ...'
Setting 1.a.txt ...
+ for x in '`ls *txt`'
+ qip-setobject -u qipman -p qipman -s QIPSYBASE -d 1.b.txt
+ echo 'Setting 1.b.txt ...'
Setting 1.b.txt ...
+ : '{'
+ clear

+ echo ''

# 2  
Old 08-10-2010
First impresssions.

First pass:

Quote:
+ qip-setobject -u qipman -p qipman -s QIPSYBASE -d 1.a.txt
Object [ real-prod.rich.com.au ] collides with a V4Object name alias.
Update failed on 10.0.0.1
qip-setobject :: Error code = 524
+ echo 'Setting 1.a.txt ...'
Setting 1.a.txt ...
+ for x in '`ls *txt`'
+ qip-setobject -u qipman -p qipman -s QIPSYBASE -d 1.b.txt
+ echo 'Setting 1.b.txt ...'
Setting 1.b.txt ...

Please bear in mind that I haven't a clue about your application.
It would appear that whatever happens in the 1.b.txt run of qip-setopject makes a successful change which then allows the 1.a.txt run to work the second time through.
An inspired guess might be to reverse the order of the runs and do "b" before "a". However if this turns out to be a "Catch 22" where you cannot have two identical "V40Object name alias" it may be necessary to use a temporary intermediate name and change in a triangular rotation to avoid the duplicate.
# 3  
Old 08-11-2010
Hi,

can you show me on my code how it should look like please.

---------- Post updated at 08:09 PM ---------- Previous update was at 02:50 PM ----------

Anyone... out there can help me reversing my code as mentioned above?

---------- Post updated at 09:05 PM ---------- Previous update was at 08:09 PM ----------

ok, perhaps if someone can add a line or two in the code so when it goes to the mod directory to first clear the Aliases= real-prod row in 1.b.txt before finshing up.

I think the issue is real-prod exist as a A record already so that is why it cant put back the name as its was already named real-prod

in DNS you cant have two same names: see error message

Rolling back objects to Original properties ...
Object [ real-prod.rich.com.au ] collides with a V4Object name alias.
Update failed on 10.0.0.1

meaning that 10.0.0.2 has an alias real-prod.rich.com.au. so the script would need to clear that column:

See columns:

Code:
1.a.txt  1.b.txt  qip-setobject.rej
[root@ESM1 modified]# cat 1.b.txt 
ObjectAddress=10.0.0.2
SubnetAddress=10.0.0.0
ObjectName=server2
DomainName=rich.com.au
ObjectClass=Server
ExpiredDate=
ServerType=None
Application=
MACAddress=
ObjectTag=
LocationID=0
RoomID=
Street1=
Street2=
City=
State=
Zip=
Country=
Manufacturer=
ModelType=
SerialNo=
AssetNo=
HostID=
PurchaseDate=
ObjectDescription=
HubName=
SlotName=
PortNum=
ContactID=0
ContactLastName=
ContactFirstName=
ContactEmail=
ContactPhone=
ContactPager=
RouterGroup=
DynamicConfig=
TftpServer=
BootFileName=
HardwareType=
Aliases= real-prod
MailForwarders=
MailHosts=
HubSlots=
DNSServers=
TimeServers=
DefaultRouters=
UserClasses=
Users=
NameService=A,PTR
DynamicDNSUpdate=A,PTR,CNAME,MX
DHCPServer=
DHCPOptionTemplate=
DHCPPolicyTemplate=
LeaseTime=-1
VendorClass=
TTLtime=-1
DualProtocol=
AllowDHCPClientsModifyDynamicObjectResourceRecords=False
Tombstoned=0
ExternalComment=
ExternalTimestamp=

and then 1.a.txt

Code:
[root@ESM1 modified]# cat 1.a.txt 
ObjectAddress=10.0.0.1
SubnetAddress=10.0.0.0
ObjectName=real-prod
DomainName=rich.com.au
ObjectClass=Server
ExpiredDate=
ServerType=None
Application=
MACAddress=
ObjectTag=
LocationID=0
RoomID=
Street1=
Street2=
City=
State=
Zip=
Country=
Manufacturer=
ModelType=
SerialNo=
AssetNo=
HostID=
PurchaseDate=
ObjectDescription=
HubName=
SlotName=
PortNum=
ContactID=0
ContactLastName=
ContactFirstName=
ContactEmail=
ContactPhone=
ContactPager=
RouterGroup=
DynamicConfig=
TftpServer=
BootFileName=
HardwareType=
Aliases=
MailForwarders=
MailHosts=
HubSlots=
DNSServers=
TimeServers=
DefaultRouters=
UserClasses=
Users=
NameService=A,PTR
DynamicDNSUpdate=A,PTR,CNAME,MX
DHCPServer=
DHCPOptionTemplate=
DHCPPolicyTemplate=
LeaseTime=-1
VendorClass=
TTLtime=-1
DualProtocol=
AllowDHCPClientsModifyDynamicObjectResourceRecords=False
Tombstoned=0
ExternalComment=
ExternalTimestamp=



---------- Post updated 08-11-10 at 02:36 AM ---------- Previous update was 08-10-10 at 09:05 PM ----------

Hi,

Could someone just loop option 4 to run twice for me rather then doing it 2x manually without showing any errors on the screen. Thats the easiest for me as I dont know how to fix this.

Could I ask any of you to provide this please.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to call a menu script and redirect each option to a text file

Hello, I want to design a script that will call an existing menu script and select options one by one and redirict the out put to a file. For example;- In the script MENU.sh there are 10 options i want to design a script MENU2.sh that will select option 2 3 4 6 7 10 and redirict the output... (4 Replies)
Discussion started by: spradha
4 Replies

2. Shell Programming and Scripting

Call one script option to other in shell script

HI Guys, My Script abc.sh 1) Checks 2) CA Scipt 3) CIA Script 0) Exit Enter Choice : Now if i select choice 2 then after finshed choice 2 wait for 40 min and run choice 3 what i can write in CA Scipt option: if then My Code : ... (3 Replies)
Discussion started by: pareshkp
3 Replies

3. Shell Programming and Scripting

su option to use with pasword in script

Hi, I am trying to create warraper script to run a shell script in which can be run using particular user id only . I have deoded the user password thst user and wanted to pass while running inside shell script as below .Script should come back to same shell after executing screen_update.sh.... (2 Replies)
Discussion started by: anthriksh2000
2 Replies

4. UNIX for Advanced & Expert Users

Hi, can some one help in selecting option in script

Hi, Some one help in completing the script: I need to write a script which has to select automatically only one option(below case only D - ALL) out of all options instead of manual entry There is an script which is used to test number of connection to different db that it connects when we... (7 Replies)
Discussion started by: PAKumar
7 Replies

5. Shell Programming and Scripting

perl script command line option driven script

could someone show me a sample command line option driven script? i want to see an easy way to write one and how i can execute it using command line options such as typing in read.pl -i <id> -c <cmds> -s <start> -e <end> would read out all the commands run by ID . from start time to... (7 Replies)
Discussion started by: kpddong
7 Replies

6. Shell Programming and Scripting

recently introduced to the newer option for find...does an older option exist?

To find all the files in your home directory that have been edited in some way since the last tar file, use this command: find . -newer backup.tar.gz Is anyone familiar with an older solution? looking to identify files older then 15mins across several directories. thanks, manny (2 Replies)
Discussion started by: mr_manny
2 Replies

7. Shell Programming and Scripting

Need help with script option

Hi, So my script reads $1 on the command line. example: SCRIPT_NAME 1111 In my script I use a nawk statement to grab $1 but I also need it to read $1 from the variable (1111 from command line in the example) nawk -F, '($1~1111)' *.$date.* What can I do so that this nawk statement... (2 Replies)
Discussion started by: llsmr777
2 Replies

8. Shell Programming and Scripting

\n option in script

I have a series of around 20 files as my program output. The final line of my script gets the no of files and the file list for the present day. The no of files shoudl be printed first and the files for today must be printed in the next line. Ialso understood that echo -e must be used for with \n.... (4 Replies)
Discussion started by: venkidhadha
4 Replies

9. Shell Programming and Scripting

option followed by : taking next option if argument missing with getopts

Hi all, I am parsing command line options using getopts. The problem is that mandatory argument options following ":" is taking next option as argument if it is not followed by any argument. Below is the script: while getopts :hd:t:s:l:p:f: opt do case "$opt" in -h|-\?)... (2 Replies)
Discussion started by: gurukottur
2 Replies

10. Shell Programming and Scripting

Script to selct an option

Dear experts, Im trying to create a script which will allow me to do the following: 1) log in with a username and password. 2) select an option. this is how the menu looks: Select one of the following options: 1 - Activation Menu 2 - Troubleshooting Menu 3 - New... (3 Replies)
Discussion started by: lweegp
3 Replies
Login or Register to Ask a Question