interactive-shell

Change save path of PHP interactive shell history

不羁岁月 提交于 2020-01-16 00:56:16
问题 I once found a way to disable session logging by php -a , php's interactive shell. How do I turn it back on? Is there a way to send logging to another, file besides ~/.php_history ? I think I may have sent the output to /dev/null . edit: It apparently still saves to the .php_history file. It doesn't save until you exit completely from the shell. I would still like to know how move the history logging to another file. 回答1: No, currently (5.3.10 ubuntu) the filename ~/.php_history is hardcoded

Python subprocess: interacting with a shell script

♀尐吖头ヾ 提交于 2019-12-22 09:37:03
问题 I have a shell script which asks the user for too many questions. I want to answer every question that ends with : with a enter , and every question that ends with a ? with y enter . e.g., Enter your name: enter Enter your email: enter ... Are you sure these details are correct? y enter I have started the subprocess with: subprocess.Popen(shell=True, stdout=sp.PIPE, stderr=sp.STDOUT, stdin=sp.PIPE) How do I poll over the script's output, waiting for the question to appear? 回答1: Try something

Custom Interactive Shell with AutoComplete

自闭症网瘾萝莉.ら 提交于 2019-12-22 06:54:27
问题 I have been tasked to create an interactive shell to be embedded in python, such that, when called from the command line it will be dropped into that shell. Can anyone recommend me a library that does this? I would need the ability to create custom words, "actions," so when the user types those words, my program can execute the correct function that I have created. I would also like the ability of auto complete / tab complete on the custom words I created. Example: $ python myapplication.py $

How to get sentiment via stanford corenlp interactive shell?

ⅰ亾dé卋堺 提交于 2019-12-13 18:47:19
问题 I have been trying to get the sentiment value from the stanford corenlp , but it seems in the interactive shell, the sentiment is not given as an output. I have specified the annotators using the command given in the official website. java -cp "*" -Xmx3g edu.stanford.nlp.pipeline.StanfordCoreNLP -annotators tokenize,ssplit,pos,lemma,ner,parse,dcoref, sentiment Also, when i tried for getting just the sentiment, then at first asked for other annotators, after providing i didn't give any output

How do I create an interactive selection?

大憨熊 提交于 2019-12-10 17:09:03
问题 I want to create an "interactive selection" in Python (not sure if I worded that correctly, look at the example below) that lets users press their up and down keys to choose an option and return to confirm it, then it continues with the script. An example output in a terminal would be something like this: $ python script.py Please select an option. [ ] Option 1 [ ] Option 2 [*] Option 3 You have chosen: Option 3 After that first string had printed, the user could use their arrow keys to

IPython behavior different for .py and .ipy files despite script being “pure” python (custom exception handler hook stops working)

こ雲淡風輕ζ 提交于 2019-12-10 14:57:53
问题 I have written an exception handler that is meant to log all uncaught exceptions in the code before calling the normal python exception hooks. Python and iPython have slightly different ways of doing this. What i have found is that the iPython way of doing it only works when run from within an interactive session, or when using a ".ipy" filename extension, despite the fact that I don't believe i am using any 'Magic,' and the regular python way of doing it won't work within ipython even if the

How to get second-to-last argument from previous bash command? (in an interactive bash shell)

浪子不回头ぞ 提交于 2019-12-06 03:55:55
问题 How can I easily get the second-to-last (penultimate) word/argument from the previous command in a bash interactive shell? I often run commands in the background, and I would like to get the file that was specified before the & , e.g., % echo foo > /tmp/foo & % cat !$ % & In the example above, !$ gives the last word, & . But I want the second-to-the-last argument, /tmp/foo Note that it is possible to use word designators with a range like !-1:3 , but this is impractical for a command with a

How to get second-to-last argument from previous bash command? (in an interactive bash shell)

点点圈 提交于 2019-12-04 07:33:01
How can I easily get the second-to-last (penultimate) word/argument from the previous command in a bash interactive shell? I often run commands in the background, and I would like to get the file that was specified before the & , e.g., % echo foo > /tmp/foo & % cat !$ % & In the example above, !$ gives the last word, & . But I want the second-to-the-last argument, /tmp/foo Note that it is possible to use word designators with a range like !-1:3 , but this is impractical for a command with a large number of words where it's not quickly obvious how many words there are, e.g., % (set -x; date;

What are the differences between a login shell and interactive shell? [closed]

。_饼干妹妹 提交于 2019-12-03 01:45:38
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . What is a login shell and interactive shell , and what is a .bash_profile and .bashrc ? 回答1: An interactive shell is one started without non-option arguments, unless -s is specified, without specifying the -c option, and whose input and error output are both connected to terminals (as determined by isatty(3)),

What are the differences between a login shell and interactive shell? [closed]

妖精的绣舞 提交于 2019-12-02 14:03:05
What is a login shell and interactive shell , and what is a .bash_profile and .bashrc ? cdarke An interactive shell is one started without non-option arguments, unless -s is specified, without specifying the -c option, and whose input and error output are both connected to terminals (as determined by isatty(3)), or one started with the -i option. An interactive shell generally reads from and writes to a user’s terminal. [ gnu bash manual ] A login shell is a shell where you login. You can recognize a login shell from a ps -f listing, it will have a hyphen at the start of the program name, for