Wrong parameters are taking


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Wrong parameters are taking
# 1  
Old 12-27-2018
Wrong parameters are taking

Hi All,

Could you please assist the below query :-

had created the below script to print the below content email, however the instance now is not displaying correctly and it is print the wrong instance name.

Please find the below code for errors.sh , in this script had written the code as print any error from last 30 days and it is redirecting to


Code:
reverting the changes


Last edited by venkat918; 12-28-2018 at 04:34 AM.. Reason: reverting
# 2  
Old 12-27-2018
Please be aware that ANY program understanding / debugging without knowledge of the data is heavily based on assumptions and thus never can be accurate. So - pls. post sample input data, structures, directories, dir structures, etc.


Quote:
Originally Posted by venkat918
...
iam expecting the instance name as T21 instead of T22
I'd say you're expecting in vain. There are five lines in your code printing something similar, but they all look like

Code:
echo "<BR>INSTANCE NAME is : T0${valn}<BR>"

, so neither of above can possibly show up in your output. And what about the instance T01 ... T04 from your first code snippet? How do the two relate to each other?


Please start over, rephrase (in full sentences!) your request, explain from a way deeper level, so people get a chance to understand and comment.


And, BTW, your five repeated code parts lend themselves to being done in a loop, greatly improving reliability and readability of the script.

Last edited by RudiC; 12-27-2018 at 12:42 PM..
# 3  
Old 12-27-2018
Quote:
Originally Posted by venkat918
...
Code:
...
for skyline_instance_name in `(cd /var/lib/mysql;ls -d skyline? | grep -v skyline1)`
...

it will redirect in to these files skyline1_ERR_LIST.log,skyline2_ERR_LIST.log,skyline3_ERR_LIST.log...)
Code:
... > /home/idcuser/logs/${skyline_instance_name}_ERR_LIST.log
...
echo "<BR>INSTANCE NAME is : T0${val1}<BR>">> email.html

Maybe because you have a variable $skyline_instance_name == [ skyline2, skyline3, skyline4, skyline5 ] but not skyline1
and does not exist file skyline1_ERR_LIST.log
Array num == [ 2, 3, 4, 5]; hence the variable $val1 starts with 2

Last edited by nezabudka; 12-27-2018 at 12:40 PM..
# 4  
Old 12-28-2018
Thanks for your response.

had applied the below logic to acheieve my output .

Code:
if [[ "${num[0]}" != "" ]] || [[ "${num[1]}" != "" ]] || [[ "${num[2]}" != "" ]] || [[ "${num[3]}" != "" ]] || [[ "${num[4]}" != "" ]]
then
val1=`echo ${num[0]}`
inst_val1=$(($val1-1))

# 5  
Old 12-28-2018
Moderator's Comments:
Mod Comment Sorry, but posting a question and then, after getting an answer, simply removing all the data to this question is ABSOLUTELY UNACCEPTABLE. You are robbing all the others who might have profited too from our effortrs to help you of the possibility to be helped at all. Kindly reinstate the previous state of your initial problem so that others can understand what it waas and how to solve it.


bakunin
These 2 Users Gave Thanks to bakunin For This Post:
# 6  
Old 12-28-2018
I'm sincere apologies for inconvienced to all, will ensure not to repeat this type thing henceforth.
# 7  
Old 12-28-2018
Hi Venkat918,

I can only agree with bakunin, this is not acceptable - it deprives members of answers when they search and is well against the ethos of a forum where people are prepared to devote time and knowledge for the benefit of others. You should reinstate the original request for help - which as bakunin pointed out you did recieve.

Regards

Gull04
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Why result is wrong here ? whether break statement is wrong ?

Hi ! all I am just trying to check range in my datafile pls tell me why its resulting wrong admin@IEEE:~/Desktop$ cat test.txt 0 28.4 5 28.4 10 28.4 15 28.5 20 28.5 25 28.6 30 28.6 35 28.7 40 28.7 45 28.7 50 28.8 55 28.8 60 28.8 65 28.1... (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

2. UNIX Desktop Questions & Answers

scripts taking arguments

I am trying to write a script using commands to print a sequence of numbers. However, I can't get jot to recognize what I give it. Terri$ cat mncmd echo "m=$1" echo "n=$2" $jot $2 Terri$ ./mncmd 1 10 m=1 n=10 ./mncmd: line 3: $2: command not found I've also tried Terri$ cat... (3 Replies)
Discussion started by: justOne21
3 Replies

3. Shell Programming and Scripting

taking characters and counting them

Nevermind, I figured out a way using the sed command. But I forget the basic way of counting characters within a variable :( (4 Replies)
Discussion started by: puttster
4 Replies

4. AIX

tuning network parameters : parameters not persist after reboot

Hello, On Aix 5.2, we changed the parameters tcp_keepinit, tcp_keepintvl and tcp_keepidle with the no command. tunrestore -R is present in inittab in the directory /etc/tunables we can clearly see the inclusion of parameters during reboot, including the file lastboot.log ... (0 Replies)
Discussion started by: dantares
0 Replies

5. Shell Programming and Scripting

Taking a particular attribute's value in a file...

HI, Iam new to scripting..I need some guidance for invoking the following logic.. My input file contains Event Time = Thu, Nov 6, 2008 08:41:56 AM Probable Cause = UnspecifiedReason Specific Problems = BTS down due to Tx ... (16 Replies)
Discussion started by: Llb
16 Replies

6. Programming

Dynamic loader taking function from wrong lib

Hi, I have two dynamically loaded libraries (shared objects), both of which include functions of the same name - foo. When I call 'foo' from libA, it takes it from libB, although it is implemented in libA as well. Since we need the function to be called from libA, we tried linking it with the... (1 Reply)
Discussion started by: rimon
1 Replies

7. UNIX for Dummies Questions & Answers

Taking a name out of $PATH

so here is my path: /usr/bin:/bin:/usr/sbin:/sbin:/Users/a:/usr/local/bin:/usr/X11/bin how would I remove only the "a" or name string within it? any help appreciated (7 Replies)
Discussion started by: cleansing_flame
7 Replies

8. UNIX for Dummies Questions & Answers

Asking on taking in and out paramter

Hi , as i'm doing a .sh script that uses $datafile variable to spool my value into another .sh script. How do i spool out my maybe another value from my second script file back to my first .sh script??? What does this exit $? mean? Thanks a lot! (1 Reply)
Discussion started by: blueberry80
1 Replies
Login or Register to Ask a Question