EzDevInfo.com

interactive-shell

bash script for learning basics of UNIX terminal.

Change save path of PHP interactive shell history

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.


Source: (StackOverflow)

differences between login shell and interactive shell [closed]

Hi everyone' I have a question about shell in linux.Before asking it I would like to say that I really made lots of search on internet however since I'm newbie on linux these are not give me any idea. Now here is my question. What is login shell and interactive shell. In addition to this, I wonder what is .bash_profile .bashrc.I spent a couple hours through them but still I have not figure them out.Thanks in advance


Source: (StackOverflow)

Advertisements

Go interactive shell [duplicate]

Possible Duplicate:
Does Go provide REPL?

Does anyone know if there is an REPL (interactive go shell, similar to irb) available for go which allows the user to use import statements? I'd like to be able to do something like this:

$igo import ( 
             "log"
             "mypackage/pkg"
            )
log.Print("hello, world!")
pkg.Print("Hello")
...

I've tried igo but that doesn't seem to support this yet.


Source: (StackOverflow)

PHP interactive shell, auto echo and a new line

Greetings fellow programmers!

Is there a way to get PHPs interactive shell, php -a, to behave more like Rails console or the console in Chrome? I have looked through the flags for the php-command, but no dice.

What I get:

php > $a = 0;
php > $a;
php > echo $a;
0php > 

What I want

php > $a = 0;
0
php > $a;
0
php > echo $a;
0
php > 

Source: (StackOverflow)

How to use the PHP interactive shell

I'm using Ubuntu 12.04 64 bit and I want to use the PHP interactive shell:

php -a

But it doesn't seem to work very well, a lot of syntax is incorrectly interpreted.

When I run php -a it displays:

interactive mode enabled

And just a cursor blinking.

I'm using: PHP 5.4.13-2~precise+1 (cli) (built: Mar 21 2013 12:17:18)

How do I use the PHP interactive shell?


Source: (StackOverflow)

What magic prevents Tkinter programs from blocking in interactive shell?

Note: This is somewhat a follow-up on the question: Tkinter - when do I need to call mainloop?

Usually when using Tkinter, you call Tk.mainloop to run the event loop and ensure that events are properly processed and windows remain interactive without blocking.

When using Tkinter from within an interactive shell, running the main loop does not seem necessary. Take this example:

>>> import tkinter
>>> t = tkinter.Tk()

A window will appear, and it will not block: You can interact with it, drag it around, and close it.

So, something in the interactive shell does seem to recognize that a window was created and runs the event loop in the background.

Now for the interesting thing. Take the example from above again, but then in the next prompt (without closing the window), enter anything—without actually executing it (i.e. don’t press enter). For example:

>>> t = tkinter.Tk()
>>> print('Not pressing enter now.') # not executing this

If you now try to interact with the Tk window, you will see that it completely blocks. So the event loop which we thought would be running in the background stopped while we were entering a command to the interactive shell. If we send the entered command, you will see that the event loop continues and whatever we did during the blocking will continue to process.

So the big question is: What is this magic that happens in the interactive shell? What runs the main loop when we are not doing it explicitly? And why does it need to halt when we enter commands (instead of halting when we execute them)?

Note: The above works like this in the command line interpreter, not IDLE. As for IDLE, I assume that the GUI won’t actually tell the underlying interpreter that something has been entered but just keep the input locally around until it’s being executed.


Source: (StackOverflow)

Does MongoDB have a shell history file?

Does MongoDB have something like a .bash_history file?

I recently typed in a long command, closed & re-opened the shell, and want to retrieve it.

Pressing up doesn't work as it seems that the history of the last shell is not accessible in the new shell.

I installed 1.8.1 with Homebrew. Is there a configuration variable I should set that will turn on MongoDB interactive shell history logging?

Here's my mongod.conf file:

# Store data in /usr/local/var/mongodb instead of the default /data/db
dbpath = /usr/local/var/mongodb

# Only accept local connections
bind_ip = 127.0.0.1
# Enable Write Ahead Logging (not enabled by default in production deployments)
journal = true

Source: (StackOverflow)

Python subprocess: interacting with a shell script

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 yenter.

e.g.,

Enter your name:
enter

Enter your email:
enter

...

Are you sure these details are correct?
yenter

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?


Source: (StackOverflow)

How do I create an interactive selection?

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 choose their option marked by the asterisk. The script would look somewhat like this:

print 'Please select an option.'
option = interactive_choice(['Option 1', 'Option 2', 'Option 3'])
print 'You have chosen: ' + option

Anyone know how to do this?


Source: (StackOverflow)

MongoDB shell history doesn't remember 'authentications'

The command line history of the interactive shell for MongoDB (2.0.4 on MacOSX Lion) doesn't work when I use commands on a collection called 'authentications', but it works fine for everything else, it seems.

$ mongo mydb
MongoDB shell version: 2.0.4
connecting to: mydb
> db.aimsx.find().count()
45
> 

Now if I hit up arrow, I get this:

> db.aimsx.find().count()

Works fine. However, now I run a command on the collection 'authentications':

> db.authentications.find().count()
795
>

When I hit up arrow now, I get this:

> db.aimsx.find().count()

No command on 'authentications' can be found in the history or in the ~/.dbshell file. Anyone has an explanation for this?


Source: (StackOverflow)

Custom Interactive Shell with AutoComplete

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
$ myapp> 
$ myapp> help
   ... prints the help menu
$ myapp> run service blah
   .. service blah runs ...
$ myapp> exit
$ 

Source: (StackOverflow)

Infer generic types on scala shell

Is it possible to use the scala shell to infer the type of a generic function?

I was trying to undestand the type of the function Future.traverse (scala 2.10). The complete generic type is

def traverse[A, B, M[_] <: TraversableOnce[_]](in: M[A])(fn: A => scala.concurrent.Future[B])(implicit cbf: generic.CanBuildFrom[M[A],B,M[B]], executor: ExecutionContext): Future[M[B]]   

which is a long enough to be almost unreadable to me, So I thought it would be a good idea to try it is some more specific types. So I tried:

> :t (x : List[_]) => (Future traverse x) _
List[_] => ((Any => scala.concurrent.Future[Nothing]) => scala.concurrent.Future[List[Nothing]])

Which helped a lot, but it would be better if I could specify the type inside the List type constructor:

:t (x : List[a]) => (Future traverse x) _

Which unfortunately (and comprehensibly) gives me a type a not found error.

Is there any way to make this work?


Source: (StackOverflow)

How to run manage.py in Eclipse Pydev Interactive Console

I am trying to run manage.py to validate models (as: manage.py validate) in the Interactive Shell of a Django project (called djangonew) using Pydev

The PYTHONPATH is set to include /djangonew ... so import djangonew and then dir(djangonew) actually gives me a name as 'settings' in the subfolder /djangonew/djangonew

but at the command-line I am unable run manage.py (and even find it)

How do I solve this issue? Thanks much


Source: (StackOverflow)

Opening Interactive PowerShell GUI script for other logged on users

Hello Folks, I have a powershell MTA (GUI script using winForms), which works well, lets take the script name to be "ENDUserMTA.ps1" which does invoke certain commands and does something which really needs admin rights. this works fine when run manually or via task scheduler or when set via [registry] RunOnce or Run or whatever when there is admin rights..

The problem is i want to invoke this script on the END users laptop and make them to work with it [interactively] Options that i have tried so far:

  1. Tried Scheduling the "ENDUserMTA.ps1" in Task Manager SYSTEM account [using When running the task, use the following user account] - this starts and run NOT INTERACTIVE [since system account does not have interactive session]

  2. Tried Scheduling the "ENDUserMTA.ps1" in Task Manager with Different user account which has admin rights [using When running the task, use the following user account] - This again starts but the GUI is not shown to the End User who has logged without admin rights, rather shown to only the user who was set under the option [When running the task, use the following user account]

My situation is not possible to create PSSessions or Delegated Remoting. I am now is middle of forest and no where to go!!!

Not sure how to invoke the script as admin to a user who has logged into a machine without admin rights..

WHat i exactly need or similar solution: When scheduling this script, i schedule the script to start atlogon[any user], after the script completes it will delete the scheduled task

Pls help.. Balaji


Source: (StackOverflow)