terminal

Printing better formating in command line

I have a php script that i run via command line like php file.php and in that file i have a print statement like print "<br>Saved the url: {$url} to :{$destination}"; I assumed the br would formant it 1 below the other but when i run the script i get this format which is really hard to read <br>Saved the url: http://example.com/a....

Change desktop picture in objective-c

How do you change the desktop picture in cocoa/objective-c? I've tried using defaults but had many errors. NSArray *args=[NSArray arrayWithObjects:@"write",@"com.apple.desktop", @"Background", @"'{default = {ImageFilePath = \"~/desktop.jpg\";};}'", nil]; NSTask *deskTask=[[NSTask alloc] init]; [deskTask setArguments: args]; [deskTas...

Mac terminal Vim will only use backspace when at the end of a line

I seem to have something odd with either my Mac 10.6 terminal or my .vimrc. When I type backspace on my laptop's keyboard, it only works when the cursor is at the end of the line. Trying to delete from within a line does nothing. MacVim operates normally. Google hasn't helped because I can't even figure out what to call this behavior. ...

What language should we use to let people extend our terminal/sniffer program?

Hello, We have a very versatile terminal/sniffer application which can do all sorts of things with TCP, UDP and serial connections. We are looking to make it extensible -- i.e, allow people to write their own protocol parsers, highlighters, etc. We created a C-like language for extending the product, and then discovered that for some ...

How can I pass a file argument to my bash script using a Terminal command in Linux?

Hello everyone! So my question is how can I pass a file argument to my bash script using a Terminal command in Linux? At the moment I'm trying to make a program in bash that can take a file argument from the Terminal and use it as a variable in my program. For example I run myprogram --file=/path/to/file in Terminal. My Program #!/bin...

Is there a way to make Textedit the default editor for text files opened in the terminal?

It there a way to make files opened for editing in the terminal open in Textedit instead? I mean, where a command might open a file for editing (like git commit), instead of opening that file in vi or emacs, it would open in Textedit (or perhaps another Textediting application of you choosing, such as Coda). And as a bonus question, is...

Context aware switching of character encoding in terminals

When working on projects that use different character encodings I find myself constantly switching the character encoding of a terminal. In some terminals (e.g. gnome-terminal) you can create profiles for different terminals (say, profile "Project A" for the project that uses UTF-8 and profile "Project B" for the one that uses ISO-8859-1...

Appending a line to a file ONLY if it doesnt already exist. Using Sed?

Hi I need to add the following line to the end of a config file: include "/configs/projectname.conf" to a file called lighttpd.conf I am looking into using sed to do this, but i cant work out how to only insert it if the line doesnt already exist. Is anyone able to enlighten me? Thanks in advance, Ben ...

Why doesn't jEdit work with the 'open' Unix command?

I recently installed jEdit on my Mac OS 10.6 system. I would like to be able to run jEdit in the terminal as I would emacs, i.e. 'emacs FILE.NAME'. My plan was to write a script jedit.sh containing... touch $1 open -a /Applications/jEdit.app $1 ...where the argument is the filename. Strangely, jEdit is opened but only with the default...

Visually distinguishing between local and remote Terminal sessions

I'm using Terminal under OS X quite extensively. I find quite annoying (and a bit dangerous, too) that my local and remote sessions look exactly the same in the Terminal. I'm wondering if it's possible - maybe through a bit of bash-programming - to clearly distinguish between local and remote sessions. A different background color would...

color text in terminal aplications in unix

Hi I started to write a terminal text editor, something like the first text editors in unix like vi. The only purpose is have a good and fun time, but I want to let in show text in color, so I could use it for edit source code. How could achieve this? There some POSIX special API for this, or I have to used ncurses (i don't want use it)...

VIM in GNU screen in Mac Terminal.app scrambled text

Trying to use Vim in Mac's Terminal.app but it's unusable, terminal is only refreshing line or column where the cursor is, so scrolling is quite bizarre. Text is being updated only on the line where the cursor is, but the rest is not changing. Very weird behavior, I've seen this on linux too, with nvidia driver, the bufferes somehow were...

Command that works in local comuter, but doesnt work in server?

Hi all, I am using ubuntu 10.04 for my desktop and Ubunt 10.04 server edition ofr my server. the following commnad: sudo pip install -e git+http://github.com/facebook/python-sdk.git#egg=facebook Works on my deskotp, but doesnt work on the server. On the server, I received the following error message: Obtaining facebook from git+ht...

Request terminal size [C - Linux]

I'm trying to make a nice looking terminal game, but a lot of the things i'd like to do need a constant screen size. So i need the program to request a certain size every time it is ran. Is this possible, if so how? ...

NetBeans Terminal Loads bashrc, but

I'm using the NetBeans integrated terminal. It enters the .bashrc file, but aliases do not seem to work. Also, I tried an echo statement to ensure that it was being executed, e.g. echo 'hello' and the terminal hangs. ...

Need help with ssh script

Hi all, I'm very new with ssh so I need some help to write some scripts. The idea is I have files distributed in different folders on a remote server. I want to copy some certain folders into another new folder also on the same server. Suppose, I know all the name of folders that I want to copy and I can list them in a text file. How c...

Making entered commands bold at the prompt

This is my current PS1 prompt definition from by .bashrc: PS1='\[\033[01;33m\]★ \[\033[01;30m\]\w \[\033[32m\]\$ \[\033[m\]' My command prompt works great and I love it, but I would like to add one more little thing. I would really like to be able to have the text I enter (commands at the prompt) bold. I know I could change the last ...

Mongrel does not shut down using CTRL-C

I am building a Rails 2.3.5 application using Ruby 1.8.7. My development platform is a MacBook Pro running Snow Leopard 10.6.4. Often during development I can not shut down mongrel using the Ctrl-C command in Terminal. It does work sometimes but 8 times out of 10 it does not work. I do not think the Ctrl-C failure is linked to any partic...

MAC OSX vim colors mangled

Here's my setup Mac OSX 10.6 VIM (default version that comes with OSX 10.6) rails.vim (installed in .vim/autoload) ir_black.vim (installed in .vim/colors) i have "colorscheme ir_black" and "syn on" in ~/.vimrc Now when I go into terminal and edit a ruby file with vim my colors are messed up. There are only a few colors showing up and...

In Scala or Java, how to print a line to console replacing its previous content instead of appending?

A Scala application does some data processing. It would be nice to show processing progress in percents overwriting previous value on change rather than appending a new value to what's already displayed. How to acheive this effect? I use Scala 2.8 on Linux. ...