0

When you login by your phone number, you can set password for that phone number using telegram cli command set_password <hint>. After pressing enter it will ask for new password:, Also after entering pass and press enter it will ask for retype new password: and after filling that password will set.

Overview:

$ Execute ./telegram-cli for specific profile
....//Initializing  
>set_password hint
new password: xxx
retype new password: xxx
>quit
$

Now I want to write a bash script to do the job but the problem is prompts. I tried something like below with no success:

#!/bin sh
./telegram-cli command for specific profile << EOF
set_password hint
#What do I have to do to enter password after prompt?  

As you know because I am in telegram cli command mode there is no commands like sleep, read or something else.
Tell me if more information needed.
Thanks in advance

Hossein Shahsahebi
  • 6,348
  • 5
  • 24
  • 38
  • @ScottMermelstein thanks but I'm looking for a way without expect, is it possible? – Hossein Shahsahebi Jan 07 '16 at 20:36
  • 1
    In my experience, no. You can write your own C program and execute it in bash, telling it what to look for and what to respond, but that's basically what `expect` does for you. – Scott Mermelstein Jan 07 '16 at 20:38
  • Thanks again, Am I have to remove this question? – Hossein Shahsahebi Jan 07 '16 at 20:45
  • This is Stack Overflow. If the question deserves to be removed, there are plenty of people who will vote to remove it. :-) The question isn't an invalid one, and you're not receiving downvotes, so the general rule is to leave the question up. Even if it's a duplicate, someone may find your question first and be helped by it. – Scott Mermelstein Jan 07 '16 at 20:48
  • There is a way to do it by PHP with `proc_open` function, but for doing it in bash maybe the `Expect` is an answer – Hossein Shahsahebi Jan 09 '16 at 06:42

0 Answers0