• Post Reply Bookmark Topic Watch Topic
  • New Topic

Writing input data to a properties file

 
Srinivas Rao Marri
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
#!/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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!