Sponsored Content
Full Discussion: Use of exec 2>/dev/null
Top Forums Shell Programming and Scripting Use of exec 2>/dev/null Post 302762287 by newbie2010 on Monday 28th of January 2013 10:05:41 AM
Old 01-28-2013
Use of exec 2>/dev/null

I have a script for which I am getting useless error messages. It is composed mostly of case statements. I placed exec 2>/dev/null at the top of the script and it works totally but the problem is that it also redirects the read command input to the /dev/null. So if a user responds to "type your name," this gets redirected to /dev/null. Is there a way to make the read command still show the input when a user types and the /dev/null to still work for all error messages? I've tried different ways but I have had no luck. The user needs to be able to see what they are typing.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

/dev/null

Hi , I am importing some table from /dev/null i dont understand what is /dev/null Sorry i am new to UNIX sam71 (3 Replies)
Discussion started by: sam71
3 Replies

2. UNIX for Advanced & Expert Users

Q1 :/dev/null Q2 -A

Hi, Q1-What does nroff -ms > /dev/null Q2- What does mean -A under STAT column : ps aux |head -20 UTIL PID %CPU %MEM SZ RSS TTY STAT STIME TIME COMMAND root 516 93,0 0,0 12 12 - A 04 nov 3906:51 wait Thank you. (4 Replies)
Discussion started by: big123456
4 Replies

3. Shell Programming and Scripting

> /dev/null

hello all, In many shell scripts i found '> /dev/null' , i am not able to get this, will any one please explain why we are using this. thanks sudha (2 Replies)
Discussion started by: rrs
2 Replies

4. Solaris

What is /dev/tty /dev/null and /dev/console

Hi, Anyone can help My solaris 8 system has the following /dev/null , /dev/tty and /dev/console All permission are lrwxrwxrwx Can this be change to a non-world write ?? any impact ?? (12 Replies)
Discussion started by: civic2005
12 Replies

5. Shell Programming and Scripting

/dev/null

Hi expert, May I know what is the difference between below cron tab entry ? 0,12 * * * * /abc/myscript.sh > /dev/null 2>&1 0,12 * * * * /abc/myscript.sh (7 Replies)
Discussion started by: olaris
7 Replies

6. Shell Programming and Scripting

/dev/null what is the use of it?

when do you use the path /dev/null (3 Replies)
Discussion started by: webmunkey23
3 Replies

7. 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

8. 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

9. Shell Programming and Scripting

Help with /dev/null Please

Hello All and a Happy New year to yous guys. I'm running the below command on my AIX box and it keeps giving me the message that the file doesn't exist. I know the file don't exist, but I don't want to see the error. 2>/dev/null doesn't work. bash-3.00$ ls -l C* | wc -l 2>/dev/null ls:... (2 Replies)
Discussion started by: bbbngowc
2 Replies

10. Shell Programming and Scripting

2>/dev/null

Friends have the following problem a search may not find anything which would correct example: ls -ltr *prueba.txt | nawk '{ print $9 }' > Procesar.dat 2>/dev/null When he finds nothing gives me the following error ls: prueba.txt: No such file or directory because 2> / dev / null... (4 Replies)
Discussion started by: tricampeon81
4 Replies
APS2FILE(1)						    BSD General Commands Manual 					       APS2FILE(1)

NAME
aps2file -- printing to a file via apsfilter SYNOPSIS
aps2file [-D] [-Pqueue] [-Zoptions] [-ooutput] [input] aps2file [-h] DESCRIPTION
With aps2file you can direct the printer data generated by apsfilter(1) into an arbitrary file without the use of a spooler. OPTIONS
-h show help screen -D enable debug mode -Pqueue select a printer queue (different from the default one) -Zoptions use apsfilter command line options (comma-separated list) -ooutput direct data stream to output (default: stdout) input read data from input (default: stdin) Unlike printing with lpr(1), you can only use one input file at a time. Using aps2file is also the recommended way to create a debugging log of a failed printing attempt. If you include the -D flag, the apsfilter shell script will log every command and print it to stderr. To save the output for inclusion into a bug report, you should therefore use a command of the sort aps2file -D -o /dev/null [-P...] [-Z...] [input] 2> log.txt NOTES
aps2file only works correctly with entries in /etc/printcap that have been created by /usr/share/apsfilter/SETUP. FILES
/etc/printcap printer capability data base /usr/share/apsfilter/bin/apsfilter apsfilter script SEE ALSO
apsfilter(1), apsfilter-bug(1), apspreview(1), apsfilterrc(5), printcap(5) BUGS
See apsfilter software center - http://www.apsfilter.org/ - for new versions, bugfixes and known bugs. Please use the new tool apsfilter-bug(1) to release bug- or problem reports. It automatically presents you a form in an editor window which asks you some standard questions. If you save and quit the editor session, then this report is sent automatically via e-mail to the proper apsfilter mailinglist. If apsfilter fails to print something or prints it in a way you wouldn't expect and you want to report an apsfilter error then please save the debugging output of one print session using the new aps2file(1) utility by typing aps2file -D -Z options file > /dev/null 2> file.debug and including the debugging output in the file file.debug into the edit session of the apsfilter-bug utility, so that it is included into the mail to the apsfilter mailinglist. Please note that you need to run /bin/sh (Bourne Shell), bash or a compatible shell, so that the above mentioned output redirection works. Under C-shell (/bin/csh) or tcsh it would't work. If you don't know, then simply make sure you use the Bournce shell by typing /bin/sh or bash, then you should have no problems with redirection of stdout and stderr (> /dev/null 2> file.debug). DOCUMENTATION
See official apsfilter homepage http://www.apsfilter.org/handbook.html Apsfilter Handbook including the Frequently Asked Questions (FAQ) USER FORUM
Please send questions to the official apsfilter help channel apsfilter-help@apsfilter.org. The above section BUGS and the file HOWTO-BUGREPORTS tells you how to report bugs. If you want to know how to troubleshoot your apsfilter installation, please read the manpage aps2file(1) and apsfilter-bug(1) as well as the Apsfilter Handbook carefully. HISTORY
The aps2file manpage has been written by Michael LoBin <phallobst@web.de> and first appeared in apsfilter V 7.1.0. BSD
Dec 19, 2001 BSD
All times are GMT -4. The time now is 10:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy