LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-26-2012, 04:21 PM   #1
Aerosilver
LQ Newbie
 
Registered: Aug 2012
Posts: 28

Rep: Reputation: Disabled
Avoid the prompt message of userdel


Hello everyone,

I want to know how I can avoid the prompt message of the userdel.
When I try to delete a user called "ss", the system show this message if it running successfully:

"no crontab for ss"

I think is a message belonged from the cron system, for programmed tasks. I don't know what's the problem.

Sorry for my poor english. I hope somebody can know what is my problem.

Thanks,
Federico.

Last edited by Aerosilver; 11-26-2012 at 04:23 PM.
 
Old 11-26-2012, 05:46 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860Reputation: 4860
The userdel command tries to delete all files that are related to the user you want to be deleted. This includes the users crontab file, where the user can schedule events. If the user has no such crontab file the userdel command simply states that fact, there is nothing wrong and it is not a warning. Just ignore it.
 
1 members found this post helpful.
Old 11-26-2012, 05:55 PM   #3
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,535

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
If you do not wish to see the message, try redirecting the 'userdel' output to /dev/null. If the command is writing to stderr, then use the 2> to direct to /dev/null, or if you wish, all output to /dev/null.

'userdel' is a command that I don't play with much on a day-to-day basis, but from the man-page, it appears that you can delete a user by just specifying the user-name. So, to direct output to never-never-land...
Code:
# userdel ss 2> /dev/null      # directs stderr to /dev/null

// or

# userdel ss >& /dev/null      # directs all output to /dev/null
If you are developing a script, you may still wish to examine the return code, by examining $?, to check whether userdel succeeded or not.
 
1 members found this post helpful.
Old 11-26-2012, 06:57 PM   #4
Aerosilver
LQ Newbie
 
Registered: Aug 2012
Posts: 28

Original Poster
Rep: Reputation: Disabled
Quote:
The userdel command tries to delete all files that are related to the user you want to be deleted. This includes the users crontab file, where the user can schedule events. If the user has no such crontab file the userdel command simply states that fact, there is nothing wrong and it is not a warning. Just ignore it.
Part of that I knew, but I want to know how to avoid that message because I am writing a shell script, and for aesthetic I wanted to know how to do that.

Well thanks for some info.

Quote:
Originally Posted by dwhitney67 View Post
If you do not wish to see the message, try redirecting the 'userdel' output to /dev/null. If the command is writing to stderr, then use the 2> to direct to /dev/null, or if you wish, all output to /dev/null.

'userdel' is a command that I don't play with much on a day-to-day basis, but from the man-page, it appears that you can delete a user by just specifying the user-name. So, to direct output to never-never-land...
Code:
# userdel ss 2> /dev/null      # directs stderr to /dev/null

// or

# userdel ss >& /dev/null      # directs all output to /dev/null
If you are developing a script, you may still wish to examine the return code, by examining $?, to check whether userdel succeeded or not.
That's run very good. Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoid to recipient getting the size limit message in Mailscanner server kalidoss Linux - Server 0 05-11-2012 04:49 AM
How to send a message in RHEL4 ES thru command prompt.. visitnag Linux - Newbie 1 03-18-2010 09:07 PM
avoid boring mutt message nnivanov Linux - Desktop 2 01-24-2007 03:54 AM
how can I customise my login to avoid prompt for user and password? krmane Slackware 6 07-13-2006 11:35 AM
/usr/bin/php: bad interpreter :::what install to avoid this message. Thank you sarajevo Linux - Software 1 09-23-2005 10:38 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration