[TriLUG] Basic bash shell scripting question

Ryan Leathers ryan.leathers at globalknowledge.com
Thu May 29 10:30:06 EDT 2003


duh! - I feel so dumb.
anyway - thanks all 

also Matthew thanks for the tip on System.getProperties()
I've used this before but had it in my mind that it was only useful for
VMs.

Ryan

On Thu, 2003-05-29 at 09:40, Ryan Leathers wrote:
> Hi gang. I am writing an application in Java, part of which needs to add
> the user name of a user logging onto a Linux host to a plain text list
> of user names.  (don't worry - this is not required or intended to be
> secure). The user will launch this application from their login script.
> It occurred to me that the simplest way to do this was to use JNI to
> drop to a bash shell and then mess with the file as needed in Java later
> on.  I suppose I could just launch the script independently of the Java
> app and get the same thing... but thats not really the point.
> 
> I have rarely done shell scripting over the years and am looking for
> some advice.  The lines below will do what I want, but how can I make
> this more elegant?  Can I accomplish this without creating deleting and
> renaming as seen below?   
> 
> whoami > name
> cat checked.txt name > checked.new
> rm checked.txt
> rm name
> mv checked.new checked.txt
> 
> Thanks,
> Ryan
> 
> _______________________________________________
> TriLUG mailing list
>     http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ:
>     http://www.trilug.org/faq/TriLUG-faq.html





More information about the TriLUG mailing list