terminal

How do I use Applescript to log me in to heroku console and count my users?

My script looks like this, really simple tell application "Terminal" do script "cd myapp" do script "heroku console" in window 1 do script "User.count" in window 1 end tell But I get an "Error in the AppleEvent Routine". What is wrong with this script? If I type the commands in the Terminal it works. ...

Detect NUL file descriptor (isatty is bogus)

The following C file gives a bogus result when NUL is piped to it: int main() { printf("_isatty = %d\n", _isatty(0)); } the result is: C:\Users\Edward\Dev\nulltest> test.exe < NUL _isatty = 64 I'm pretty sure NUL (aka /dev/null) is not a terminal device! So I need to detect in another way whether or not the file descriptor corres...

How can I use nftw(...) and define the block size for the stat function

Hi, I want to use nftw() to traverse my file system directory structure and sum up how many space each directory is using. I don't want to use du because it make fork call. I used nftw (with the flag - FTW_PHYS), nftw calls stat but i noticed that the default block size is 512bytes , while my file system use a different block size. any ...

Perl Net::SSH::Perl not loading my environment variables vs connecting through SSH

Hey , My problem is connecting throguh Net::SSH::Perl vs Connecting through SSH. my shell variables ( command: export ) aren't the same. This fact prevents me from executing user's script that depends on the shell env vars. For example: if i execute through perl ( Net::SSH::Perl ) the command: "export" I get: MAIL=/var/mail/username...

Deploying a Ruby project.

I have a finished Ruby project that has the standard structure for a multiple file Ruby program: project/ lib/ # Files the driver program uses go here. bin/ # Driver program goes here. tests/ # Unit tests go here. What I want to be able to do is type in project into the command line from any directory and have my progra...

How to fix path variable in bash on Mac OSX Snow Leopard

This might be a noob question, but I need help. I screwed up my terminal by trying to alter my path variable using the following command: $ sudo nano .profile Before I did that, if I were to type: $ echo $PATH I would get: /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin When I opened .profile in nano it told me that the fil...

Equivalent to `stty size` on Windows.

I'm using some Ruby code that shells out to stty size to get the size of the terminal, but I'm running on Windows. What is the Windows equivalent? ...

Is there a way to stop terminal from clearing my program's output?

Hi, I am trying to compile a library and I get errors. I cannot see the complete output because the terminal automatically clears the output and shows only the last few lines/ pages. I am able to redirect to a txt file and see the complete output. But is there a way to see the whole output on my terminal?? ...

Copying files across computers using SSH and MAC OS X Terminal

Im trying to copy my .profile, .rvm and .ssh folders/files to a new computer and I know how to use the cp and ssh commands but I'm not sure how to use them in order to transfer files from one computer to another. Any help would be great, thanks! ...

Terminal on the web browser?

Is there a way to put the terminal on the web browser instead, so I just fire up localhost:80 and then I'll have a terminal on it that I can use and whatever I execute it will execute on my local web server? And the outputs I want to be displayed on the web browser too, just like a normal Terminal. I'm using Ruby on Mac OS X/Ubuntu. ...

Create an app from a bash script that accepts arguments?

Hi As it says ... in OSX can i create an application based off a bash script - that accepts arguments ? So for example i can run in terminal : open /path/to/MyBashScriptApp.app myArgument1 This app will run with the argument passed to it? I know i can rename to .command - but i need it to be an app . ...

How to read from terminal stream in java GUI application?

I have a hardware system that will be writing to the terminal stream. I need to be able to monitor that stream for updates (writes) from my java application. How can I do this? I've only ever interacted with the terminal in a pure console application. I could also write my application in .Net languages, so I'll accept answers for .NE...

Testing for color support in Linux shell scripts

This is the second time I've wanted to do this and again my google-fu has failed me. When in the course of running a shell script (in my case a bash script) is there a program/script that tests whether the current shell supports color? Alternatively is there a way to take the terminal type and easily determine if it supports color? Ei...

Would it be possible to replace CMD with something else?

I never studied OSes, so forgive me if this sounds basic or silly, but I'm curious about if one could replace the cmd prompt in Windows. I am NOT asking for programs that actually do this, as I've looked around and not really seen any. What I'm asking is 1) if it's actually possible to write an entirely new program that would behave li...

Python Script execute commands in Terminal

Hello, I read this somewhere a while ago but cant seem to find it. I am trying to find a command that will execute commands in the terminal and then output the result. For example: the script will be: command 'ls -l' It will out the result of running that command in the terminal ...

Python Script Fails To Run When Launched From Shell File, But Works When Launched From Terminal

If I launch the Google Code upload Python script from Terminal, it works as expected, but when I launch it using the code below in a Bourne Shell Script file, it fails with the error "close failed in file object destructor: Error in sys.excepthook: Original exception was:". #!/bin/sh BUILD_FOLDER="/Users/James/Documents/Xcode Projects/U...

How do I create a new branch based on an existing Git hub branch? (Please read - tried the beginners guide)

I have a master branch and would like to create a new branch based on it, and then switch to the new branch. I'm very very new to coda/github/terminal so I don't even know if my syntax is correct. here's what I typed in, letter for letter, with the exception of the branch names which are placeholders: git checkout -b $newbranchname ...

C Variable from Terminal

Hey guys, I'm writing a program to read a file and display the number of lines and words in said file, simple stuff. What I want is to be able to run the program from terminal (running Ubuntu) by simply typing: count But I'm not sure how to get the filename into a variable in the C program. Little help please? Thanks in advance. ...

Hook up into another Terminal process?

I've got two terminal instances/processes opened with different PID. Is it possible to from one of them, hook up into the other so when I type something and it outputs something, then the other terminal will see the output too (maybe the input too if possible?). Just like cloning the terminals. I want this because then I can hook up s...

trace() not written to flashlog.txt

Hi I'm using mxmlc on a Mac terminal to compile an AS 3.0 project and then I run it by opening the Main.swf in Flash Debugger 10. Now, errors get written to the flashlog.txt just fine but my trace statements don't : ( I have mm.cfg in /Library/Application Support/Macromedia and it contains the following lines: ErrorReportingEnable=1 Tr...