Anyone good with Linux shell could tell me what's wrong with this script ? for i in $(cat adresses.txt); do echo -n $(date +"%D %H","%H") >>Resultats.txt; echo -n , >>Resultats.txt;sudo bwping ${i} > /dev/null 2> /dev/null >>Resultats.txt; done
hi bwping ${i} >/dev/null 2> /dev/null >>Resultats.txt this seems a bit wrong from the point of view of out direction , i mean if you are sending the standard output of the command bwping $i to null device as well as the standard errors , what do you expect to have in the Resultant file ? !!!
Hello and thanks for your response ! What I'm trying to do there is send the results to "Resultats.txt" without printing it on the screen. Sadly, it doesn't even get there in the execution, it doesn't wanna fetch the argument $i from the file "adresses.txt".
How about: while read i do 1 > Resultats.txt #stuff done < addresses.txt The while, do, done is a loop for reading one line from addresses.txt and putting it in i. Multiple fields can be used. File Descriptor 1 (stdout) is redirected to Resultats.txt. FD 2 (stderr) will still go to the screen.
Tried your modif @rsmith6559 , still an error on final line (done < addresses.txt)...
Or could it be an error in the number of arguments expected near the command bwping..
I don't know, I've been doing read loops like that for years. I tested it with: ``` #!/bin/bash while read LINE do echo "$LINE" done < test.sh exit 0 ``` and got just what I expected, first shot.
I'll work on it some more when I have time, probably just an error with arguments. Thanks for your help, greatly appreciated !
Join our real-time social learning platform and learn together with your friends!