Joined
·
548 Posts
I'm hoping this is the alternative place to ask for Linux programming help here. Unless not being sure, please move this thread to the right section, in case there is a subforum dedicated to Linux programming.
I'm trying to write a script in Linux, which uses the bash shell, but I can't seem to create the solution to it.
The homework problem is that I need to find the most recent (newest) account created in Linux. The only way I can think of is to use the user ID code, and pick the largest number between 1000 and 2000.
I can't figure out how to get the user ID from reading across many lines in /etc/passwd.
So far, it's like this:
Am I doing this correctly? Or I am doing it the wrong way...?
Thanks in advance.
I'm trying to write a script in Linux, which uses the bash shell, but I can't seem to create the solution to it.
The homework problem is that I need to find the most recent (newest) account created in Linux. The only way I can think of is to use the user ID code, and pick the largest number between 1000 and 2000.
I can't figure out how to get the user ID from reading across many lines in /etc/passwd.
So far, it's like this:
Code:
while read line
do
acct='echo $line | cut -f1 -d:'
if [ "$line" > 1000 && "$line" < 2000 ]; then
grep $line | cut -d ':' -f 3
fi
done
Thanks in advance.