Sponsored Content
Top Forums Shell Programming and Scripting redirect stderr to dev/null in bash env. Post 101309 by vino on Tuesday 7th of March 2006 06:14:43 AM
Old 03-07-2006
Quote:
Originally Posted by Sniper Pixie
Working in a bash environment, in the following example, how do I direct the error message that putting in an invalid flag (-j for example) would normally produce to dev/null?

while getopts "abcd" opt
do
case "$opt" in
i) a etc ;;
r) b etc ;;
f) c etc ;;
v) d etc ;;
\?) direct actual error message to dev/null

exit 1 ;;
esac
done
Code:
while getopts "abcd" opt
do
    case "$opt" in
      i) a etc ;;
      r) b etc ;;
      f) c etc ;;
      v) d etc ;;
      *) exit 1 ;;
    esac
done

Just exit.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

redirect stderr and/or stdout to /dev/null from command line

Is it possible to redirect errors at the command line when you run the script such as bash scriptname & 2>/dev/null? (1 Reply)
Discussion started by: knc9233
1 Replies

2. Shell Programming and Scripting

can't redirect stderr in bash

Consider: #!/bin/sh #this is a shell script in sh (bourne) grep missingfile 2>errout.txt It works from the command line, but keeps producing errors from the script. So how do I redirect in a bash shell...or bourne? (3 Replies)
Discussion started by: lumix
3 Replies

3. Shell Programming and Scripting

How to redirect the import log to /dev/null?

Hi i am running oracle database import through a script and script scans the import log to see if there are any errors. Now the porblem is that when i run the script the import log appears on the screen even if i direct the output of import to /dev/null. imp "'/ as sysdba'"... (5 Replies)
Discussion started by: vinoo128
5 Replies

4. Shell Programming and Scripting

ssh, bash, and /dev/stderr: no such device

Hello, When I run the following program: ssh 192.168.1.4 bash -l <<EOF > echo foo >/dev/stderr > EOF I get the following confusing error. bash: line 1: /dev/stderr: No such device or address Does anyone know why and how to fix it? I'm capturing stdout in a variable, but I... (2 Replies)
Discussion started by: brsett
2 Replies

5. UNIX for Dummies Questions & Answers

/dev/null 2>&1 Versus /dev/null 2>1

How are these two different? They both prevent output and error from being displayed. I don't see the use of the "&" echo "hello" > /dev/null 2>&1 echo "hello" > /dev/null 2>1 (3 Replies)
Discussion started by: glev2005
3 Replies

6. Shell Programming and Scripting

Redirecting standard out to /dev/null goes to file "/dev/null" instead

I apologize if this question has been answered else where or is too elementary. I ran across a KSH script (long unimportant story) that does this: if ; then CAS_SRC_LOG="/var/log/cas_src.log 2>&1" else CAS_SRC_LOG="/dev/null 2>&1" fithen does this: /usr/bin/echo "heartbeat:... (5 Replies)
Discussion started by: jbmorrisonjr
5 Replies

7. Shell Programming and Scripting

[Solved] Stdout stderr to /dev/null

Sorry for my ignorance... but... I've a script with some output redirect to /dev/null, example: fsck.ext3 -a /dev/sdb1 1>/dev/null 2>/dev/null How can I simplify this redirect ? (1 & 2) thanks (3 Replies)
Discussion started by: ionral
3 Replies

8. Shell Programming and Scripting

redirect the audio output to /dev/null

I'm using an text-to-speech synthesis in a script, and I need to redirect it's output to /dev/null how can I do that ? And how to redirect the stream to his normal output then (sound card ) ? thankx (2 Replies)
Discussion started by: firelink
2 Replies

9. UNIX for Dummies Questions & Answers

Redirect Standard Error to /dev/null is not working.

Hello. When I run a .ksh that contains the command below, and there is no file available in the source location the "FILE_NAME_*.CSV not found" error is still being displayed. FILEN=$(ssh ${SOURCE_SERV} "cd ${SOURCE_LOCATION} ;ls ${FILES}") 2> /dev/null. This is interfering with the rest... (4 Replies)
Discussion started by: jimbojames
4 Replies

10. Shell Programming and Scripting

Redirect string from bash stderr to user stdin

Hi there, I need to execute a command in the bash. The program prints some standard (output and) error and then wants the user to choose one of several options and type the according input. I am trying to solve this issue in a bash script but also running into some circular dependency. How can I... (7 Replies)
Discussion started by: fredestet
7 Replies
doc::lua-oocairo-fontopt(3)				       Lua OO Cairo binding				       doc::lua-oocairo-fontopt(3)

Name
       lua-oocairo-fontopt - options controlling text rendering

Introduction
       A font options object contains options that tell Cairo how to render text on surfaces.  They can be created with the "font_options_create"
       function in the main oocairo module (see lua-oocairo(3)), and retrieved from scaled fonts or context objects with "get_font_options"
       methods.

       Font options objects can be compared with the "==" operator.  Two different objects with the same options set will be considered equal.

Methods
       The following methods are available on font options objects:

       opt:copy ()
	   Returns a new font options object, with identical options to opt.  The two objects will be completely independent, so you can set them
	   to have different options.

       opt:get_antialias ()
	   Get the current antialiasing mode, which will be one of the strings accepted by the "opt:set_antialias()" method.

       opt:get_hint_metrics ()
	   Returns the current hint metrics option, which will be one of the same strings accepted by the "opt:set_hint_metrics()" method.

       opt:get_hint_style ()
	   Get the kind of font hinting done when rendering text.  Returns one of the strings accepted by the "opt:set_hint_style()" method.

       opt:get_subpixel_order ()
	   Returns the current ordering of colour components in pixels used for subpixel rendering, which will be one of the same strings accepted
	   by the "opt:set_subpixel_order()" method.

       opt:hash ()
	   Return a number which can be used as a hash key identifying the particular options in opt.  That is, if you wanted to cache fonts
	   according to the options set on them, you could store them in a table with this hash value as the key.  Two font options objects with
	   the same options will have the same hash value.

       opt:merge (srcopt)
	   Add any options which are set to a non-default value in srcopt to opt if that still has the default value from them.  The options in
	   srcopt will be unchanged.  Nothing is returned.

       opt:set_antialias (antialiastype)
	   Set the antialiasing mode used for drawing.	The argument must be a string or boolean value accepted by the "set_antialias" method on
	   context objects (see lua-oocairo-context(3)).

       opt:set_hint_metrics (hintmetrics)
	   Set the kind of hinting to be applied to the metrics, as opposed to outlines, of the glyphs in a font.  The hintmetrics value must be
	   one of the following strings:

	   default
	   off
	   on
       opt:set_hint_style (hintstyle)
	   Set the kind of font hinting done when rendering text.  The hintstyle value must be one of the following strings:

	   default
	   none
	   slight
	   medium
	   full
       opt:set_subpixel_order (order)
	   Used to inform Cairo of the arrangement of colour components in the pixels of a display device like a monitor.  Only applies if
	   subpixel antialiasing is used.  The order value must be one of the following strings:

	   default
	   rgb
	   bgr
	   vrgb
	   vbgr

	   The last two options refer to vertical arrangements of colours.

1.4								    2011-05-18					       doc::lua-oocairo-fontopt(3)
All times are GMT -4. The time now is 12:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy