Trap triggered by "wrong parenthesizes" ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Trap triggered by "wrong parenthesizes" ?
# 1  
Old 08-08-2018
Trap triggered by "wrong parenthesizes" ?

I have following traps(s) in my code

Line 913 triggers one of the traps with parenthesizes around

(case-insensitive).
Checked by removing them.

Since it is a text I do not mind removing the offending () .


But why it triggers both traps ?



PS Where does the "bad" in trap message comes from ?
There is nothing bad with trap , it is "good" to report problems.





And I do not get the ERR line number - but that is another issue I'll tackle later..





Code:

TRAPS


# ----------------------------------------------
 308 # Step #3: Trap CTRL+C, CTRL+Z and quit singles
 309 # ----------------------------------------------
 310 trap '' SIGINT SIGQUIT SIGTSTP
 311  



err_report() {
  31     echo "Error on line $1"
  32 }
  33
  34 trap 'err_report $LINENO' ERR




OFFENDING CODE 



do_hostname() {
 910   if [ "$INTERACTIVE" = True ]; then
 911     whiptail --msgbox "\
 912 Please note: RFCs mandate that a hostname's labels \
 913 may contain only the ASCII letters 'a' through 'z' (case-insensitive), 
 914 the digits '0' through '9', and the hyphen.
 915 Hostname labels cannot begin or end with a hyphen. 
 916 No other symbols, punctuation characters, or blank spaces are permitted.\
 917 " 20 70 1



TRAP output 



pi@pi:/usr/bin $ sudo raspi-config.debug_7.sh
trap: ERR: bad trap
trap: SIGINT: bad trap
/usr/bin/raspi-config.debug_7.sh: 913: /usr/bin/raspi-config.debug_7.sh: Syntax error: "(" unexpected (expecting "fi")

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Solaris

Trap signal on Window Manager "X" button clicked?

Well, my first post... thanks in advance! Can applications be notified of the X Window close (with "X" button) so the signal handler can run a cleanup process method? About the app: built with GNU C/C++ on Solaris 10, with WxWidgets. It is launched by a shell script as a background task. The... (2 Replies)
Discussion started by: HandsOGold
2 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

unix "trap" command behaviour

Hi I am using "trap" command in my script to prevent the user from running Ctrl-C during the its execution. My script creates number of children processes which in turn create some children processes as well during the execution. When user / tester tries to run Ctrl-C, the parent process is... (1 Reply)
Discussion started by: aoussenko
1 Replies

7. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

8. Solaris

"Trap 3e" OBP error on Ultra 5.

My Ultra 5 (Solaris 10) is now unbootable, with the OBP failing with error "trap 3e" When it tries to boot from disk. Disk is a Maxtor 80GB IDE, and was working previously. I've booted to cdrom and run "Format" from Single user, but when I try to read the disk, it just core dumps. I have... (2 Replies)
Discussion started by: akbar
2 Replies

9. UNIX for Dummies Questions & Answers

"trap" password expiration message

The majority of the users on our system are "captured" users where they log into script that is launched via their .profile. The password expiration message flashes by very quickly before they get the "menu" portion of the script to continue. Other than a sleep at scripts startup to slow... (2 Replies)
Discussion started by: MizzGail
2 Replies
Login or Register to Ask a Question