Suppressing output from /dev/null ?

How do i get the report to go away

Page 1 of 1

7 Replies - 2249 Views - Last Post: 22 December 2009 - 09:17 AM Rate Topic: -----

#1 Braber01  Icon User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 252
  • Joined: 29-November 08

Suppressing output from /dev/null ?

Posted 19 December 2009 - 08:28 AM

I'm currently making a twitter shell for my own amusment here is the code:

#!/bin/bash
#Twitter.sh
#Revised making use of Twitter and Twitter's api using a shell prompt 
#That looks like "twitter> "

clear
echo "Login to Twitter..."
echo
echo "Twitter Username?"
read -p "twitter> " USER
echo
echo "Twitter Password?"
read -sp "twitter> " PASS

echo "Welcome to the Twitter shell."
echo "What do you want to do?"
CMD=""

while [ "$CMD" != "bye" ];
do
	 read -p "twitter> " CMD
	 echo
	 if [ "$CMD" == "show" ]; then
		  echo "not programmed yet"
	 elif [ "$CMD" == "update" ]; then
		  echo "Update your status to...?"
		  read -p "twitter> " STATUS
		  curl -u "$USER":"$PASS" -d status="$STATUS" http://twitter.com/statuses/uptade.xml > /dev/null
		 echo "Status updated"
	 elif [ "$CMD" == "bye" ]; then
		  clear
	 else
		echo "not an option"
	 fi
done



How do i get rid of the report that /dev/null prints out? I don't want the user of the application to see it

Is This A Good Question/Topic? 0
  • +

Replies To: Suppressing output from /dev/null ?

#2 Braber01  Icon User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 252
  • Joined: 29-November 08

Re: Suppressing output from /dev/null ?

Posted 19 December 2009 - 01:25 PM

adding the command clear did it
Was This Post Helpful? 0
  • +
  • -

#3 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: Suppressing output from /dev/null ?

Posted 19 December 2009 - 01:45 PM

/dev/null prints something? I thought /dev/null just was a place to pipe things when you didn't want or need them sticking around.

Could it be that you're not redirecting (like STDERR) all output from curl?
Was This Post Helpful? 0
  • +
  • -

#4 Braber01  Icon User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 252
  • Joined: 29-November 08

Re: Suppressing output from /dev/null ?

Posted 19 December 2009 - 02:47 PM

View Postsnoj, on 19 Dec, 2009 - 12:45 PM, said:

/dev/null prints something? I thought /dev/null just was a place to pipe things when you didn't want or need them sticking around.

Could it be that you're not redirecting (like STDERR) all output from curl?


well when i tried
curl -u "$USER":"$PASS" -d status="$STATUS" http://twitter.com/statuses/update.xml | /dev/null 


it prints:
bash: dev/null: No such file or directory
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
101 2125 100 2003 0 122 2501 152 --:--:-- --:--:-- --:--:-- 3464

and i got the same thing using the '>' symbol so i just added a clear after it and everythings is allright.
Was This Post Helpful? 0
  • +
  • -

#5 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5411
  • View blog
  • Posts: 27,423
  • Joined: 10-May 07

Re: Suppressing output from /dev/null ?

Posted 19 December 2009 - 11:52 PM

You shouldn't pipe /dev/null, you use /dev/null as a dumping ground for output that you don't want to see. It's about data pipes, Standard in, out, and error. If you only wish to see the errors, then you pipe standard out to /devl/null & the same with if you only wish to see standard out, you'd pipe standard error to /dev/null, lastly if you wish to see no output, just pipe all output to /dev/null.

For example 1 is stdout stream & 2 is the stderr stream :

ls /root/ 2> /dev/null # errors are piped to /dev/null & not seen on standard out


Was This Post Helpful? 0
  • +
  • -

#6 Braber01  Icon User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 252
  • Joined: 29-November 08

Re: Suppressing output from /dev/null ?

Posted 20 December 2009 - 03:41 PM

View Postno2pencil, on 19 Dec, 2009 - 10:52 PM, said:

You shouldn't pipe /dev/null, you use /dev/null as a dumping ground for output that you don't want to see. It's about data pipes, Standard in, out, and error. If you only wish to see the errors, then you pipe standard out to /devl/null & the same with if you only wish to see standard out, you'd pipe standard error to /dev/null, lastly if you wish to see no output, just pipe all output to /dev/null.

For example 1 is stdout stream & 2 is the stderr stream :

ls /root/ 2> /dev/null # errors are piped to /dev/null & not seen on standard out


I've tried this trick using both
curl -u "$USER":"$PASS" -d status="$STATUS" http://twitter.com/statuses/update.xml  1> /dev/null

curl -u "$USER":"PASS" -d status="$STATUS" http://twitter.com/statuses/update.xml 2>/dev/null

and

curl -u "$USER":"$PASS" -d status="$STATUS" http://twitter.com/statuses/update.com 3> /dev/null



and NONE of them have worked any advice???

View Postno2pencil, on 19 Dec, 2009 - 10:52 PM, said:

You shouldn't pipe /dev/null, you use /dev/null as a dumping ground for output that you don't want to see. It's about data pipes, Standard in, out, and error. If you only wish to see the errors, then you pipe standard out to /devl/null & the same with if you only wish to see standard out, you'd pipe standard error to /dev/null, lastly if you wish to see no output, just pipe all output to /dev/null.

For example 1 is stdout stream & 2 is the stderr stream :

ls /root/ 2> /dev/null # errors are piped to /dev/null & not seen on standard out


I've tried this trick using both
curl -u "$USER":"$PASS" -d status="$STATUS" http://twitter.com/statuses/update.xml  1> /dev/null

curl -u "$USER":"PASS" -d status="$STATUS" http://twitter.com/statuses/update.xml 2>/dev/null

and

curl -u "$USER":"$PASS" -d status="$STATUS" http://twitter.com/statuses/update.com 3> /dev/null



and NONE of them have worked any advice???
Was This Post Helpful? 0
  • +
  • -

#7 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5411
  • View blog
  • Posts: 27,423
  • Joined: 10-May 07

Re: Suppressing output from /dev/null ?

Posted 21 December 2009 - 09:56 PM

View PostBraber01, on 20 Dec, 2009 - 04:41 PM, said:

any advice???

Yes.

Use CURL correctly :) Don't suppress the output at the command prompt, use CURL with --silent.
Was This Post Helpful? 0
  • +
  • -

#8 Braber01  Icon User is offline

  • D.I.C Regular

Reputation: 5
  • View blog
  • Posts: 252
  • Joined: 29-November 08

Re: Suppressing output from /dev/null ?

Posted 22 December 2009 - 09:17 AM

View Postno2pencil, on 21 Dec, 2009 - 08:56 PM, said:

View PostBraber01, on 20 Dec, 2009 - 04:41 PM, said:

any advice???

Yes.

Use CURL correctly :) Don't suppress the output at the command prompt, use CURL with --silent.


cURL asks me for a password each time i tried to use the --silent or the -s flag I know this is a bad way of programming but I'm new to linux and I'm going to stick with what works for me thanks anyway
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1