Sponsored Content
Full Discussion: UNIX Program Change Question
Top Forums UNIX for Dummies Questions & Answers UNIX Program Change Question Post 93853 by Perderabo on Thursday 22nd of December 2005 02:53:47 PM
Old 12-22-2005
Try something like this:
Code:
#! /usr/bin/ksh

#      yyyymmddhhmm.ss
pstart=200510312359.59
  pend=200511302359.59

fpstart=/tmp/pstart_$$
fpend=/tmp/pend_$$


touch -t $pstart $fpstart
touch -t $pend $fpend

cd /some/directory
echo List of files in $PWD $pstart $pend
find . ! -name . -prune -newer $fpstart ! -newer $fpend -type f | sed 's/^\.\///' | xargs ls -ld
echo End of List of files in $PWD $pstart $pend
rm $fpstart $fpend
exit 0

This will find files whose modification time is between the two timestamps. pstart is the last second before the period of interest, while pend is the last second of the period of interest. The sequence "! -name . -prune" will prevent the "find" command from desending into subdirectories to search for files. Remove that sequence if you want to search the entire directory heirarchy. The output from "find" will be stuiff like "./filename" but the sed statement removes that leading "./" for a nicer look.

Bear in mind that anyone can change the mod time of a file to anything by using the "touch" command just like this script does.
 

10 More Discussions You Might Find Interesting

1. Programming

QUESTION...simple program?

I am new to the unix/linux environment. AND........ I need to create a mini shell..that displays prompt (i.e., READY:$), accepts a command from std-in, and prints the command and any parameters passed to it. HELP!!!! (8 Replies)
Discussion started by: jj1814
8 Replies

2. UNIX for Dummies Questions & Answers

UNIX Backup program question

How do UNIX backup programs know which files to dump. Unlike Windows, UNIX files do not have the "archive" bit, yes? So, again, how does it know which file(s) to dump. Thanks in advance. (1 Reply)
Discussion started by: MayDHorseBwithU
1 Replies

3. Shell Programming and Scripting

script/program to change the password ?

hi, Somebody have or known where i can find a perl small perl program to change the password. The point: First it verify is the user exist, checking the old typed password and replace it with new. The passwords must be encoded. Thanks, very much! (0 Replies)
Discussion started by: kad
0 Replies

4. Shell Programming and Scripting

perl program question

why does below program not work? <> is producing nothing.. still waiting for input.. but i thought this would work? #!/usr/bin/perl -w use strict; my @array2; my @array1 = ("David Veterinarian 56", "Jackie Ass 34", "Karen Veterinarian 28"); $_ = @array1; while (<>) { ... (4 Replies)
Discussion started by: hankooknara
4 Replies

5. Programming

Change Pseudo Code to C Program (print and fork)

I am very new at programming and this is probably an easy question, but I am desperate. I need to change this low level code into a C program that I can run so I can print out every "A" that appears with the fork() command. You help is greatly appreciated. PRINT A p=fork() if( p == 0) {... (0 Replies)
Discussion started by: tpommm
0 Replies

6. Debian

Change the privileges needed to run a program

Hi everyone, I have an issue with a project of mine. I have to run a program on a terminal which requires to be logged in as su to have it run it. Given that I'm having problem to use expect to give the password I'd like to change the privilege of that program from SU to normal user ( I have the SU... (13 Replies)
Discussion started by: gaisselick87
13 Replies

7. UNIX for Dummies Questions & Answers

Change to different user id inside a program

Hi, There is a process ( built in C/C++) which starts with my user id and I need to execute a specific function with a different user id. Is there any api so that I provide userid, passwd and the next instance the process will have the new user id privileges. - Pranav (3 Replies)
Discussion started by: k_pranava
3 Replies

8. Programming

Question regarding Bash program

Hello All, I am trying to write a small bash script to make my life easier for an analysis. I have multiple folders and inside them are 10 output files with an extension .pdbqt What I am trying to do is to read the folder content and then make a PyMol (.pml) file to load the molecules and then... (11 Replies)
Discussion started by: biochemist
11 Replies

9. Programming

Cash Register Change Program

I just need some suggestions on how to start this program I wanted to work on for practice. I want to make a cash register program that gives change and only works with $1's, $5's, $10's, and $20's (I might add cents in later for more practice). Change should always be made with the largest... (9 Replies)
Discussion started by: totoro125
9 Replies

10. Shell Programming and Scripting

Question regarding whence program

Hi all, In production code, if using the whence command it picks the production file.if I am using the test code file. by using whence command it not picking the file. do you have any idea on this. Whence prodcode it picks the exact path of the prodcode. whence testcode. it... (1 Reply)
Discussion started by: ramkumar15
1 Replies
getauid(2)																getauid(2)

NAME
getauid, setauid - get or set user audit identity SYNOPSIS
cc [ flag ... ] file ... -lbsm -lsocket -lnsl [ library ... ] #include <sys/param.h> #include <bsm/libbsm.h> int getauid(au_id_t *auid); int setauid(au_id_t *auid); The getauid() function returns the audit user ID for the current process. This value is initially set at login time and inherited by all child processes. This value does not change when the real/effective user IDs change, so it can be used to identify the logged-in user even when running a setuid program. The audit user ID governs audit decisions for a process. The setauid() function sets the audit user ID for the current process. Upon successful completion, the getauid() function returns the audit user ID of the current process on success. Otherwise, it returns -1 and sets errno to indicate the error. Upon successful completion the setauid() function returns 0. Otherwise, -1 is returned and errno is set to indicate the error. The getauid() and setauid() functions will fail if: EFAULT The auid argument points to an invalid address. EPERM The {PRIV_SYS_AUDIT} privilege is not asserted in the effective set of the calling process. The getauid() function will fail if: EPERM The {PRIV_PROC_AUDIT} privilege is not asserted in the effective set of the calling process. USAGE
Only a process with appropriate privileges can successfully execute these calls. bsmconv(1M), audit(2), getaudit(2), privileges(5) The functionality described on this manual page is available only if the Basic Security Module (BSM) has been enabled. See bsmconv(1M) for more information. These functions have been superseded by getaudit(2) and setaudit(). 31 Mar 2005 getauid(2)
All times are GMT -4. The time now is 04:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy