LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-26-2015, 02:31 PM   #1
MattFly
Member
 
Registered: Apr 2015
Posts: 98

Rep: Reputation: Disabled
How to enter data automatically on terminal? (script BASH)


I want to create a script wich will enter a password automatically on terminal an press "enter" for my. Wich comands should I use?(Enter the user and the pass actually)

Last edited by MattFly; 04-26-2015 at 03:04 PM.
 
Old 04-26-2015, 05:53 PM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,153

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
please post what you have already done, and what app you want to feed the password to there may be better ways of doing it if we had a bit more info
 
Old 04-26-2015, 06:26 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
You wouldn't do stuff like that with Bash normally, this is what Expect is for: http://www.nist.gov/el/msid/expect.cfm
 
Old 04-27-2015, 05:50 AM   #4
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
If you want to not be presented with a login screen at startup then you make init scripts not start '/bin/login' instead start '/bin/bash'. Usually agetty invokes 'login' so change it to invoke 'bash'.
 
Old 04-27-2015, 07:08 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,883
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
I think you ought to describe better what you wish to do. You may be thinking you need to do certain things and find that they're not necessary. This is where the advice to post what you do have now will be helpful for various reasons.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] make a script that opens a specific terminal and enter commands into that terminal jejuba Linux - General 2 11-10-2013 01:43 PM
Script to Hit 'Enter' key multiple times in bash script. nithinmp Ubuntu 7 07-19-2012 07:01 AM
making a script that opens terminal and enter commands into that terminal Cinematography Linux - General 8 12-16-2008 10:34 AM
Testing for enter in bash script bwysocki Programming 8 06-16-2005 09:11 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration