Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Handling decision making logic Post 302996770 by Vijaykannan T on Tuesday 2nd of May 2017 04:51:07 AM
Old 05-02-2017
Handling decision making logic

-------
Output Screen
--------

Choose the option
-----------------
1.Input
2.Output
3.CFT Uniq
x.Exit
-----------------

2
Enter the Output flow IDF
PBL5572U

Enter the Output existing flow IDF
PBL5198H

sf_PBL5572U.cmd file exist in invalid path or doesn't exist
diff: input file /apps/cftpkg2b/3.1.3/filusr/sf_PBL5572U.cmd: No such file or directory
The sf_PBL5572U.cmd coding is correct

Coding:

Code:
  
 echo "******CFT CHECKS********"
 echo "Choose the option"
 echo "-----------------"
echo      1.Input
echo      2.Output
echo      3.CFT Uniq
echo      x.Exit
echo "-----------------"
 read opt
case $opt in
         1) echo "1"
         ##find /apps/cftpkg2b/3.1.3/filusr/  -name *$1* -exec ls -ltr {} \; 2>/dev/null
        ;;
         2) echo "2"
           echo "Enter the  Output  flow IDF"
           read i
           echo '\n'
           echo "Enter the Output existing flow IDF"
           read j
           echo '\n'
         if [ -s /apps/cftpkg2b/3.1.3/filusr/sf_"$i.cmd" ]
         then
         echo "sf_"$i.cmd" file exist"
         else
         echo "sf_"$i.cmd" file exist in invalid path or doesn't exist"
          fi
         diff  /apps/cftpkg2b/3.1.3/filusr/sf_"$i.cmd" /apps/cftpkg2b/3.1.3/filusr/sf_"$j.cmd" > COMPFILE1
                 if [ -s COMPFILE1 ]
                 then
                 cat COMPFILE1
                 echo "Cross verify the   sf_"$i.cmd"  codes "
                 else
                 echo "The sf_"$i.cmd" coding is correct"
                #find /apps/cftpkg2b/3.1.3/filusr/ -name "*$i*" -exec ls -ltr {} \; 2>/dev/null > out_file2.txt
                fi
         ;;
        3) echo "3" ;;
        x|X) break ;;
        *)echo "Invalid output" ;;

Please look at the above coding and output.

The ultimate aim of the program is finding the difference in two files on the location /apps/cftpkg2b/3.1.3/filusr.


What I have done is

(consider only option 2)

1. input of first file
2. Input of second reference file (usually standard couple of files).
3. Checking the existence of input file in mentioned path.
if file exist, then display the file and find the difference between the files.
4. if there is a difference moving the difference into a new file(COMPFILE1).

and later manually we will check the difference and correct the file.


Now problem is in case the user gives the different file name and if the second input reference file is not available on that path , no difference is shown and user may think there is not difference in file contents. So this logic goes wrong .Please help to handle.

Last edited by Vijaykannan T; 05-02-2017 at 10:51 PM.. Reason: corrections
 

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Query on decision making...

is_number() { echo $1|egrep '^*$' 2>&1 1>/dev/null return $? }why the following snippet always give an output as "no" and never "yes" whatever the parameter I give to function is_number? if ]; then echo yes; else echo no; fi In addition, the function is_number() is... (5 Replies)
Discussion started by: biglau
5 Replies

2. Shell Programming and Scripting

shell script with decision making

Hi all I need help for the issue below. I need to create script: FORM_cmd=query || import FORM_command=add FORM_msisdn=389881234567 FORM_provcode=SK FORM_attr=12 FORM_cmd can be "query" or "import" when FORM_cmd="query" then execute -> spdci -cmd $FORM_cmd FORM_cmd when... (3 Replies)
Discussion started by: vasil
3 Replies
3DS2MGF(1)							     RADIANCE								3DS2MGF(1)

NAME
3ds2mgf - Autodesk 3D Studio to Raytracer file Translator SYNOPSIS
3ds2mgf inputfile[.3ds] [outputfile] [options] DESCRIPTION
-snnn - Smooth triangles with angles < nnn -l<filename> - Specifies native material library -a<filename> - Use animation information in specified file -fnnn - Generate frame nnn of animation -x<object> - Exclude this object from conversion -b<object> - Convert this object as a box +i, -i - Turn internal bounding on or off +v, -v - Turn verbose status messages on or off -op - Output to POV-Ray 2.0 format -op1 - Output to POV-Ray 1.0 format -ov - Output to Vivid format -ol - Output to poLyray format -om - Output to MGF -or - Output to RAW triangle format ex. /usr/bin/3ds2mgf birdshow +v -lmaterials.inc SEE ALSO
mgf2inv(1), mgf2meta(1), mgf2rad(1), mgfilt(1) 3ds2mgf 2.0 November 2007 3DS2MGF(1)
All times are GMT -4. The time now is 03:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy