How to start screen session with commands?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I'm connecting to a device via screen
that requires that I enter some credentials (username and password). It's getting annoying to do that on every entry, so I'd like to alias a command to do that for me:
This alias in ~/.bash_aliases
is insufficient:
alias devlogin="sudo screen /dev/ttyACM0 9600 && 'rmyusername' && rmypassword"
gnu-screen
add a comment |Â
up vote
1
down vote
favorite
I'm connecting to a device via screen
that requires that I enter some credentials (username and password). It's getting annoying to do that on every entry, so I'd like to alias a command to do that for me:
This alias in ~/.bash_aliases
is insufficient:
alias devlogin="sudo screen /dev/ttyACM0 9600 && 'rmyusername' && rmypassword"
gnu-screen
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm connecting to a device via screen
that requires that I enter some credentials (username and password). It's getting annoying to do that on every entry, so I'd like to alias a command to do that for me:
This alias in ~/.bash_aliases
is insufficient:
alias devlogin="sudo screen /dev/ttyACM0 9600 && 'rmyusername' && rmypassword"
gnu-screen
I'm connecting to a device via screen
that requires that I enter some credentials (username and password). It's getting annoying to do that on every entry, so I'd like to alias a command to do that for me:
This alias in ~/.bash_aliases
is insufficient:
alias devlogin="sudo screen /dev/ttyACM0 9600 && 'rmyusername' && rmypassword"
gnu-screen
edited Jan 31 at 19:06
asked Jan 31 at 18:44
tarabyte
92741429
92741429
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
Does it have to be screen
? Another option is to instead use expect
or similar to open the device, issue whatever commands are necessary, and then turn things over to the user. This has the advantage of keeping the password out of the command line (where it is often visible across the system):
#!/usr/bin/env expect
# open up serial and configure
set fh [open /dev/ttyACM0 RDWR NOCTTY NONBLOCK]
fconfigure $fh -mode 9600,n,8,1
# link above up with expect
spawn -noecho -open $fh
send -- "rmyuser"
send -- "rHunter2"
# over to the user now
interact
add a comment |Â
up vote
0
down vote
Using stuff
with the right syntax seems to work:
alias evdlogin="sudo screen /dev/ttyACM0 9600 -X stuff $'rmyusernamermypassword'"
Note that it's generally bad practice to hard-code a password in plain text, but since this is a development environment...
http://aperiodic.net/screen/quick_reference
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Does it have to be screen
? Another option is to instead use expect
or similar to open the device, issue whatever commands are necessary, and then turn things over to the user. This has the advantage of keeping the password out of the command line (where it is often visible across the system):
#!/usr/bin/env expect
# open up serial and configure
set fh [open /dev/ttyACM0 RDWR NOCTTY NONBLOCK]
fconfigure $fh -mode 9600,n,8,1
# link above up with expect
spawn -noecho -open $fh
send -- "rmyuser"
send -- "rHunter2"
# over to the user now
interact
add a comment |Â
up vote
1
down vote
Does it have to be screen
? Another option is to instead use expect
or similar to open the device, issue whatever commands are necessary, and then turn things over to the user. This has the advantage of keeping the password out of the command line (where it is often visible across the system):
#!/usr/bin/env expect
# open up serial and configure
set fh [open /dev/ttyACM0 RDWR NOCTTY NONBLOCK]
fconfigure $fh -mode 9600,n,8,1
# link above up with expect
spawn -noecho -open $fh
send -- "rmyuser"
send -- "rHunter2"
# over to the user now
interact
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Does it have to be screen
? Another option is to instead use expect
or similar to open the device, issue whatever commands are necessary, and then turn things over to the user. This has the advantage of keeping the password out of the command line (where it is often visible across the system):
#!/usr/bin/env expect
# open up serial and configure
set fh [open /dev/ttyACM0 RDWR NOCTTY NONBLOCK]
fconfigure $fh -mode 9600,n,8,1
# link above up with expect
spawn -noecho -open $fh
send -- "rmyuser"
send -- "rHunter2"
# over to the user now
interact
Does it have to be screen
? Another option is to instead use expect
or similar to open the device, issue whatever commands are necessary, and then turn things over to the user. This has the advantage of keeping the password out of the command line (where it is often visible across the system):
#!/usr/bin/env expect
# open up serial and configure
set fh [open /dev/ttyACM0 RDWR NOCTTY NONBLOCK]
fconfigure $fh -mode 9600,n,8,1
# link above up with expect
spawn -noecho -open $fh
send -- "rmyuser"
send -- "rHunter2"
# over to the user now
interact
answered Feb 1 at 14:51
thrig
22.3k12852
22.3k12852
add a comment |Â
add a comment |Â
up vote
0
down vote
Using stuff
with the right syntax seems to work:
alias evdlogin="sudo screen /dev/ttyACM0 9600 -X stuff $'rmyusernamermypassword'"
Note that it's generally bad practice to hard-code a password in plain text, but since this is a development environment...
http://aperiodic.net/screen/quick_reference
add a comment |Â
up vote
0
down vote
Using stuff
with the right syntax seems to work:
alias evdlogin="sudo screen /dev/ttyACM0 9600 -X stuff $'rmyusernamermypassword'"
Note that it's generally bad practice to hard-code a password in plain text, but since this is a development environment...
http://aperiodic.net/screen/quick_reference
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Using stuff
with the right syntax seems to work:
alias evdlogin="sudo screen /dev/ttyACM0 9600 -X stuff $'rmyusernamermypassword'"
Note that it's generally bad practice to hard-code a password in plain text, but since this is a development environment...
http://aperiodic.net/screen/quick_reference
Using stuff
with the right syntax seems to work:
alias evdlogin="sudo screen /dev/ttyACM0 9600 -X stuff $'rmyusernamermypassword'"
Note that it's generally bad practice to hard-code a password in plain text, but since this is a development environment...
http://aperiodic.net/screen/quick_reference
edited Feb 2 at 6:34
answered Jan 31 at 19:05
tarabyte
92741429
92741429
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f421040%2fhow-to-start-screen-session-with-commands%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password