Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'skip:/ 10': 0.09; 'subject:script': 0.09; 'cc:addr:python-list': 0.11; 'file;': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'recognizing': 0.16; 'sparks': 0.16; 'storing': 0.16; 'sudo': 0.16; 'wrote:': 0.18; 'user.': 0.19; 'cc:addr:python.org': 0.22; 'print': 0.22; 'creating': 0.23; 'script.': 0.24; 'versions': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'extension': 0.26; 'header :In-Reply-To:1': 0.27; 'wondering': 0.29; 'message- id:@mail.gmail.com': 0.30; 'directory,': 0.31; "user's": 0.31; 'file': 0.32; 'there.': 0.32; 'there,': 0.34; 'subject:the': 0.34; 'received:google.com': 0.35; 'there': 0.35; 'done': 0.36; 'subject:?': 0.36; 'skip:. 20': 0.38; 'pm,': 0.38; 'either': 0.39; 'called': 0.40; 'first': 0.61; 'information': 0.63; 'home': 0.69; 'to:none': 0.92; 'technique': 0.93; 'subject:Check': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=FH+z+m24OUCr2GcPu/CMyBXSguzIuIme/LFoFOMDXl4=; b=U8RMWg7S1tUcYe8FXcL/h6dhDd57grCIVYC53XqfMSHOsCZtgKGmYFYdzzgkQNwtFx 8L4Ms55jIM++5i6NqjAU8ln4CfSdznwaHGcq2OmdfOHmuHROhaxC2UTGGB3Q/05IyWLt qMoj7IwN5Q5Lk+6zQPXTU87OeR5LrCrhRIVlCHQuYfYMEvYkbzmg38K1C//qgJC13SOr SG/2yUVhipkom1SuI4ggbr9wg9oCBQkxsPjLvNRaAiyzgkfG5VePu6N5pcyoyGZaCxrd 6cc3wDOjrtCZfc+T8XPIkVE9oXoODfXABDPtzKVFBZFQTA83uCVOlraLGwAW9LEcGIr2 qpUA== MIME-Version: 1.0 X-Received: by 10.221.64.20 with SMTP id xg20mr22219693vcb.3.1401179119186; Tue, 27 May 2014 01:25:19 -0700 (PDT) In-Reply-To: References: Date: Tue, 27 May 2014 18:25:19 +1000 Subject: Re: Check to see if the script has been previously used? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401179127 news.xs4all.nl 2888 [2001:888:2000:d::a6]:47141 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72106 On Tue, May 27, 2014 at 5:45 PM, KC Sparks wrote: > I was wondering if there was an extension or way that would allow me to > print instructions if it is the first the the user has used the script. The trickiest part is defining the 'user'. Generally, this sort of thing is done by creating a file; if the file's not there, it's the first time. Some versions of sudo will create a file called .sudo_as_admin_successful in the user's home directory; others create /var/lib/sudo/ as a directory, and storing information there. Either technique works well for recognizing a first-time user. ChrisA