Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Error Code Generated by Script Post 303044585 by richmaxw on Thursday 27th of February 2020 03:11:23 AM
Old 02-27-2020
Error Code Generated by Script

Hi,

I have written a script with several variables derived from here documents. However, when I run the following code, the exit status becomes 1:

Code:
BMC_ACEs="Rich"

read -r -d '' BMC_ACL <<EOF
###
### ACL Rack01-BMCMgmt_IN
###
$BMC_ACEs
EOF

If I then type echo $?, it displays a 1. I need my code to return 0 unless there is a real error. I have error-handling code elsewhere in the script that catches the error and echoes it to the user:

Code:
# Error handling
failure()
{
  local lineno=$1
  local msg=$2
  echo "Line $lineno: $msg"
}

trap 'failure ${LINENO} "$BASH_COMMAND"' ERR

Is there a mistake in my code or is there a workaround to get it to return 0?

Thanks,

Rich
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need a script to Append date to generated .txt file

Hi, Can anyone plz share their experience with - Building shell script to append the file with date in following format- Filename_MMDDYYYY.txt Thanks in advance (2 Replies)
Discussion started by: prince_of_focus
2 Replies

2. Infrastructure Monitoring

snmp,how to edit code generated by mib2c?

Hi, I'm reading net-snmp site, using C language and unix environment, I have manager ( do get/set command), agent and server ... I'm trying to monitor cpu, memory and disk usage and get Ip address of server and send the value back to agent, stored in variable which enable manager to gets the... (1 Reply)
Discussion started by: zainab
1 Replies

3. Shell Programming and Scripting

shPID file generated from shell script

I have a ksh script that runs a sqlplus script. Every time I run the ksh script it generates a log file like it should and a file called shPID (sh47398.1) with the text of the sql script. Why is it doing this? It is the only ksh script that I have that does this. thanks. (0 Replies)
Discussion started by: djehresmann
0 Replies

4. Shell Programming and Scripting

Script to Grep column 3 from csv file generated yesterday

Hello, Can any one please assist how to scirpt it: Every day a new log file is create and I want to process only the one generated yesterday and get the data of column 3 and 6. For example today's date is 24 then I want to get the data of log file created on 23rd. Log Files in... (7 Replies)
Discussion started by: sureshcisco
7 Replies

5. Solaris

Script fails when generated output file reaches a particular size

Hi All, New to unix. Here is the problem. Running a script that extracts data from hyperion essbase and generates a file in unix. This script fails most of the times with a very low success rate. The data has increased a lot in the last few months resulting in the file being more than 2 gb. ... (2 Replies)
Discussion started by: noufalshaw
2 Replies

6. UNIX for Advanced & Expert Users

perl script to transfer newly generated files by scp

Hi all, I have root directory on server 1 say A and having sub directory B now my application generates output files and put in sub directory B. now i need to transfer these files from server1 to server2 by scp which is having same directory structure A and sub directory B I have tried... (2 Replies)
Discussion started by: tushar_spatil
2 Replies

7. Shell Programming and Scripting

Script to grep for a string in log files generated in last 15 minutes.

Dear Guru's I've a requirment to grep for a string in series of log files that are getting generated almost every minute. I'm looking to schedule a script every 15 mountes,in order to check if the error string has been generated in any of the log files generated in last 15 minutes. Please... (3 Replies)
Discussion started by: rajivatnova
3 Replies

8. UNIX for Advanced & Expert Users

Script to rename file that was generated today and which starts with date

hello, can someone please suggest a script to rename a file that was generated today and filename that being generated daily starts with date, its a xml file. here is example. # find . -type f -mtime -1 ./20130529_4995733057260357019.xml # this finename should be renamed to this format.... (6 Replies)
Discussion started by: bobby320
6 Replies

9. Shell Programming and Scripting

Script to mount nas-share using generated credentials (mount EC 13,32)

Heyas At home i have 1 nas with 3 shares, of which i used to mount 2 of them using a script with hardcoded password and username in it. EDIT: Turns out, its not the script, but 'how i access' the nas share.. (-o user=XY,password=... VS. -o credentials=...). Figured about credential files,... (0 Replies)
Discussion started by: sea
0 Replies

10. Shell Programming and Scripting

Error message while openning the xls file generated by UNIX

Hi All, I have created a unix script to mail the xls file.This is being done using mailx command fdate=`tail -1 abc.xls | cut -c1-8` SUBJECT="CARD GL Exceptions : ${ENV} for ${fdate}" destname=CARD_GL_Exceptions_$fdate sed 's/#BUSINESS/BUSINESS/1' abc.xls > abc2.xls mv abc2.xls abc.xls... (2 Replies)
Discussion started by: karthik adiga
2 Replies
AnyEvent::XMPP::Error::MUC(3pm) 			User Contributed Perl Documentation			   AnyEvent::XMPP::Error::MUC(3pm)

NAME
AnyEvent::XMPP::Error::MUC - MUC error Subclass of AnyEvent::XMPP::Error METHODS type This method returns either: join_timeout If the joining of the room took too long. no_config_form If the room we requested the configuration from didn't provide a data form. subject_change_forbidden If changing the subject of a room is not allowed. message_error If this is an unidentified message error. If we got a presence error the method "presence_error" returns a AnyEvent::XMPP::Error::Presence object with further details. However, this class tries to provide a mapping for you (the developer) to ease the load of figuring out which error means what. To make identification of the errors with XEP-0045 more clear I included the error codes and condition names. Here are the more descriptive types: password_required Entering a room Inform user that a password is required. (Condition: not-authorized, Code: 401) banned Entering a room Inform user that he or she is banned from the room (Condition: forbidden, Code: 403) room_locked Entering a room Inform user that the room does not exist and someone is currently creating it. (Condition: item-not-found, Code: 404) room_not_creatable Entering a room Inform user that room creation is restricted (Condition: not-allowed, Code: 405) use_reserved_nick Entering a room Inform user that the reserved roomnick must be used (Condition: not-acceptable, Code: 406) not_on_memberlist Entering a room Inform user that he or she is not on the member list (Condition: registration-required, Code: 407) nickname_in_use Entering a room Inform user that his or her desired room nickname is in use or registered by another user (Condition: conflict, Code: 409) room_full Entering a room Inform user that the maximum number of users has been reached (Condition: service-unavailable, Code: 503) The condition and code are also available through the AnyEvent::XMPP::Error::Presence object returned by "presence_error", see below. text This method returns a human readable text if one is available. presence_error Returns a AnyEvent::XMPP::Error::Presence object if this error origins to such an error and not some internal error. message_error Returns a AnyEvent::XMPP::Error::Message object if this error origins to such an error and not some internal error. AUTHOR
Robin Redeker, "<elmex at ta-sa.org>", JID: "<elmex at jabber.org>" COPYRIGHT &; LICENSE Copyright 2007, 2008 Robin Redeker, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-01-23 AnyEvent::XMPP::Error::MUC(3pm)
All times are GMT -4. The time now is 01:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy