• Post Reply Bookmark Topic Watch Topic
  • New Topic

input value when executing shell  RSS feed

 
Irvan Kosini
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to do pass a value when running shell, for example

command:
login
delay 200
username
delay 200
password

so i didnt have to input anything when i running it
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want a .sh file?
 
Irvan Kosini
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yup, i want a sh file.

just when like when you use login command it always asking for password, so what i need is when i run an sh for login that contain user and pass it can automaticaly input the userpass without me input it.
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hardcoding or recording passwords sounds positively dangerous to me.
 
Irvan Kosini
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its ok , because i just it on local, not public.

Can you tell me how to do it ?
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it isn't OK even in a local folder.
you should be able simply to copy the entire instruction to a .sh file.
 
Irvan Kosini
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i just take login as example, i just want to know how to do it TT
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
generally, a shell script is just a list of commands you'd enter on a command line. so basically, you would take the exact list you posted above, and replace "username" with the actual username. you'd replace "password" with the actual password.

To echo what Campbell said, it is extremely dangerous. you may think it is only local, but what if someone manages to get on your machine? it would be easy to fine all the .sh scripts and then parse them to mine data.

how much time do you think this will save you? maybe 1 second each time you log on, but since you have a built in delay anyway, it's really just you willing to sacrifice security for laziness.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!