redirection entree sortie


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting redirection entree sortie
# 1  
Old 09-11-2009
redirection entree sortie

Bonjour,

J'ai un répertoire /travail qui est vide.

je lance dans une console

cd /travail
puis
rmdir aa 2>&1 > /dev/null
et s'affiche alors " rmdir : aa :Aucun fichier ou répertoire de ce type."

J'essaie de comprendre :
rmdir aa 2>&1 redirige 2 vers 1 donc le message d'erreur vers la sortie
écran
et > /dev/null envoie cette sortie sur rien . Aussi je ne comprends
pas que dans ce cas un message d'erreur apparaisse.

Où est mon erreur de raisonnement.
Merci beaucoup.
# 2  
Old 09-11-2009
Hello quiestu, instead of :
Code:
rmdir aa 2>&1 > /dev/null

You should try:
Code:
rmdir aa > /dev/null 2>&1

# 3  
Old 09-11-2009
Quote:
Originally Posted by Scrutinizer
Hello quiestu, instead of :
Code:
rmdir aa 2>&1 > /dev/null

You should try:
Code:
rmdir aa > /dev/null 2>&1

Thanks.
But why" rmdir aa 2>&1 > /dev/null" print a message
# 4  
Old 09-11-2009
C'est 2>/dev/null que tu dois écrire qui veut dire "envoie les messages d'erreur à la poubelle".
2>&1 redirige les erreurs sur la sortie standard (ecran) donc les affiche ensuite tu dis envoie sortie ecran dans poubelle mais plus rien à afficher....

En espérant avoir été assez clair....

regarde ce lien...très intéressant....Chapitre

---------- Post updated at 08:32 AM ---------- Previous update was at 08:31 AM ----------

Euh dernière chose....on va se faire taper sur les doigts...ce forum est ANGLAIS...
@+
# 5  
Old 09-11-2009
Hello,

Per our forum rules, all users must write in English, use semi-formal or formal English language and style, and correct spelling errors.

The reason for this is that most software and operating systems are written in English and these are software related technical forums.

In addition, nearly 95% of all visitors to this site come here because they are referred by a search engine. In order for future searches on your post (with answers) to work well, you need to spell correctly!

So, as a benefit and courtesy to current and future knowledge seekers, please be careful with your language, check your spelling and correct your spelling errors. You might receive a forum infraction if you don't pay attention to this.

Also, do not write in cyberpunk or abbreviated chat style under any circumstances and do not use profanity. This is not a chat room, it is a formal knowledge base to serve you and everyone, of all ages and cultural backgrounds.

Thanks!

The UNIX and Linux Forums
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

about different redirection

explain the redirections 1>, 2>, 3>, ..... and 1< ,2<,3<..... where we use these things thanks Thread moved from AIX forum (2 Replies)
Discussion started by: tsurendra
2 Replies

2. Shell Programming and Scripting

Redirection

Hello All, I am using the below script to gather various tools running by the user, we have more than 100 tools running on the server so my challenge is to redirect memory & cpu load to the file with the name of the tool.so am using the below script i am stucking how to redirect to the file... (2 Replies)
Discussion started by: ajaincv
2 Replies

3. Shell Programming and Scripting

Redirection question

I want to redirect stderr and have the following peice of code $ cat t1.ksh #!/bin/ksh func2() { diff /tmp/jdlkwjdlkejew /tmp/djlkwejdlewdjew >$OUTPUT_FILE 2>>$ERR_FILE } func1() { let counter=0 while do print -u2 "Error: In main function" func2 let... (1 Reply)
Discussion started by: BeefStu
1 Replies

4. Shell Programming and Scripting

redirection error

Hi i am facing a very strange problem suppose the parameters which i passed to the script is -o 140 then my code is as follows echo $* | awk '{ for ( i=0;i<=NF;i++){if ($i= -o) { print ${i+1} } } ' | read abc echo $abc abc=`echo $* | awk '{ for ( i=0;i<=NF;i++){if ($i= -o) { print... (5 Replies)
Discussion started by: aishsimplesweet
5 Replies

5. Shell Programming and Scripting

I/O redirection

Hello everyone,I'm reading a book and there's code fragment: exec 3>&1 ls -l 2>&1 >&3 3>&- | grep bad 3>&- exec 3>&- It says that the red part of that code does not close fd 3 but the green does close the fd 3.I can't understand that.....Why?Any predicate will be appreciated.:) (18 Replies)
Discussion started by: homeboy
18 Replies

6. UNIX for Dummies Questions & Answers

Help with Redirection

Hi Guys, I m new to UNIX and new to this forum. Was wondering if someone can help me understand redirection (standard input output pipeline etc) for starters, not too sure what this would mean who | sort > sortedfile | pr | lp im starting to understand common commands but when throwing... (2 Replies)
Discussion started by: jmack123
2 Replies

7. Shell Programming and Scripting

Redirection using csh

I have a csh script which I am using to run a program set data = $argv set inmod = $argv set nxz = $argv # Remove the file extension .pmod set data = ` echo $data | awk 'BEGIN { FS=".dat" } { print $1 }' ` set inmod = ` echo $inmod | awk 'BEGIN { FS=".vmod" } { print... (8 Replies)
Discussion started by: kristinu
8 Replies

8. Shell Programming and Scripting

redirection problem

hi all, how to redirect the stdout msg in command line and file at the same time? e.g i got the script named test.sh, content as following: #!/bin/sh echo "111" when i run the script ./test.sh > log.log, it will wirte the "111" into log.log, but how to show the "111" in command line... (2 Replies)
Discussion started by: eric_wong_ch
2 Replies

9. Shell Programming and Scripting

redirection

Hi, The code below works, it's a part of a bash shell script that serve to search a pattern $pattern_da_cercare in the files contained in a directory $directory_iniziale. Now the proble is: How can I redirect stderr to a file? PS: so I want to redirect ALL the errors to a file. I tryed... (9 Replies)
Discussion started by: DNAx86
9 Replies

10. Programming

Help with redirection

Here is my problem. I don't know make this redirection thing work. The output file (called output.c) looks like this #include<stdio.h> int main() { int k; int m; print f("%d\n", k); printf("%d\n", m); return 0; } the input file(called input.c) is this #include<stdio.h> int... (2 Replies)
Discussion started by: Shallon1
2 Replies
Login or Register to Ask a Question