jQuery in Action, 2nd edition
The moose likes Linux / UNIX and the fly likes Writing input data to a properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Writing input data to a properties file" Watch "Writing input data to a properties file" New topic
Author

Writing input data to a properties file

Srinivas Rao Marri
Greenhorn

Joined: Jun 07, 2006
Posts: 11
Hi,

I want to write a shell script for entering user name and password and store it into a properties file in OS. How can i do this?

Regards
Srinivas
Brian Wright
Greenhorn

Joined: Dec 12, 2005
Posts: 11
#!/usr/bin/ksh

# use \c to suppress the default newline
echo "Enter userid: \c"
read USERID

# use \c to suppress the default newline
echo "Enter password: \c"

# set alt character set to obscure the password
tput smacs
read PASSWORD

# reset to standard character set
tput rmacs
echo ${USERID}:${PASSWORD} >> output.file


It's pretty basic but it'll do the job, if I understand your requirements correctly. You could always loop it until you select 'q' to quit or the like, depending on how sophisticated you want to make it.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Writing input data to a properties file