Sponsored Content
Top Forums Shell Programming and Scripting How to trap set -o nounset in bash Post 302535024 by DGPickett on Wednesday 29th of June 2011 11:40:20 AM
Old 06-29-2011
It is possible to test before you touch. Personally, I turn it off and write scripts where unset and "" are equivalent. It makes for more code and more ways to fail, more costly than can be offset by any speed it adds to debugging!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to trap unix signal if the process killed/interupt occured in bash...

hey champs, I have a process running.......i have to catch/trap the signal when the process is being interupted/killed (kill -9 pid) option...... how can i achieve the same thru my process........ let my process is a.sh and it supposed to take 13 mins to complete, but due to some problem ,... (15 Replies)
Discussion started by: manas_ranjan
15 Replies

2. Shell Programming and Scripting

test-and-set in bash

I'm not talking about the assembly instruction TAS, a better name could be check-and-set :) Anyway, is there a way to simplify the following if ; then VAR="something"; fi I have ~20 variables that should be test-and-set like this, and it really looks lame. (2 Replies)
Discussion started by: rayne
2 Replies

3. Shell Programming and Scripting

Cntl+z Trap is not detecting ??? Help required to add a trap detection ???

Hi folks, I have tried to add some trap detection in the below script....this script is used to monitor database activities...in a rather awkward way :rolleyes:.... The idea behind adding trap is that....this script creates lots of temporary files in the running folder to store the count... (1 Reply)
Discussion started by: frozensmilz
1 Replies

4. Shell Programming and Scripting

Bash Trap Problem?

Hey all, I'm a fairly new shell scripter (been writing some very basic stuff for a couple of years once in a blue moon). I have the need to start 2 or 3 processes from within a bash script when it's run then have the script kind of hang out and wait for the user to ctrl+c and when that happens... (3 Replies)
Discussion started by: jsabino
3 Replies

5. Shell Programming and Scripting

Record the Signal Type or Number in Bash Trap function

In my Bash script I have an exit/cleanup function in a trap statement like: trap exitCleanup 1 2 3 6 15 25 Is there anyway to capture which signal # has occurred to record in a log file. Please note I am trying to avoid something like: trap 'mySignal=1; exitCleanup' 1 trap... (1 Reply)
Discussion started by: ckmehta
1 Replies

6. Homework & Coursework Questions

VM trap may work differently than a pure install trap.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: That is the last reply I received from my instructor, and I'm looking for some alternatives. When using... (2 Replies)
Discussion started by: newuser45
2 Replies

7. Shell Programming and Scripting

Shell script to set trap for finding cron job failures

Unix box: solaris 5.8 Server: IP Need to to set trap for cron job failures by writing a shell script (5 Replies)
Discussion started by: ChandruBala73
5 Replies

8. Shell Programming and Scripting

Bash - trap error file not found

Hello. In bash, is there a way to trap error "file not found" when a script call another script which is not found; then abort. Example ( part of script running with -x option set) : + return 0 + RETURN_CODE=0 + ] + /root/bin/200_yast_install/00_reset_yast_install bash:... (5 Replies)
Discussion started by: jcdole
5 Replies

9. Shell Programming and Scripting

How do i check if all parameters are set in bash?

Hi, I have 4 parameters passed to my shell and i validate if all four are entered using the following snippet: if then echo "Not entered" else echo "entered" fi I get the following output as 'Not entered even when i enter the values for all prompts. Please advise. Thanks. (5 Replies)
Discussion started by: Jesshelle David
5 Replies

10. Shell Programming and Scripting

Bash set dummy ?

Could somebody please provide me with verbatim description / purpose of the following ? set dummy $ac_prog; ac_word=$2 set dummy $ac_tool_prefix; ac_word=$2 could it be written set dummy $ac_prog; ac_word=$2 set dummy $ac_tool_prefix; ac_word=$2 (9 Replies)
Discussion started by: anne
9 Replies
cfspeed(3C)															       cfspeed(3C)

NAME
cfgetospeed(), cfsetospeed(), cfgetispeed(), cfsetispeed() - tty baud rate functions SYNOPSIS
DESCRIPTION
These functions set and get the input and output speed codes in the termios structure referenced by termios_p. The termios structure con- tains these speed codes representing input and output baud rates as well as other terminal related parameters. Setting the parameters on a terminal file does not become effective until is successfully called. returns the output speed code from the termios structure referenced by termios_p. sets the output speed code in the termios structure referenced by termios_p to speed. The speed code for a baud rate of zero, is used to termi- nate the connection. If is specified, the modem control lines are no longer asserted, which normally discon- nects the line. returns the input speed code from the termios structure referenced by termios_p. sets the input speed code in the termios structure referenced by termios_p to speed. RETURN VALUE
returns the output speed code from the termios structure referenced by termios_p. returns the input speed code from the termios structure referenced by termios_p. and return zero upon successful completion. Otherwise, they return -1 and set to indicate the error. ERRORS
and fail when the following condition is encountered: [EINVAL] The value of speed is outside the range of possible speed codes as specified in WARNINGS
and can be used to set speed codes in the termios structure that are not supported by the terminal hardware. SEE ALSO
tcattribute(3C), thread_safety(5), termio(7). STANDARDS CONFORMANCE
cfspeed(3C)
All times are GMT -4. The time now is 10:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy