shell

How can I detect that emacs-server is running from a shell prompt?

I want to have my .bashrc detect if running emacsclient would work in lieu of running emacs. Basically: if emacs_server_is_running; then EDITOR=emacsclient VISUAL=emacsclient else EDITOR=emacs VISUAL=emacs fi What would I put in the emacs_server_is_running function to accomplish this aim? ...

VBScript! JScript! Wscript! ... oh my!

I need to write some scripts for WinXP to support some of the analysts here at Big Financial Corp. Please help me decide which type of windows scripting best fits my needs. My needs seem pretty simple (to me anyway) run on WinXP Pro SP2 (version 2002) not require my users to install anything (so Powershell is out. Likewise Perl, Pyth...

Linux: Is this a correct way to run scripts in parallel?

Hello! I want to update a large amount of SVN-versioned projects at once, using a script. It takes very long when running update jobs one by one. So I tried to run the jobs in parallel. It seems to work, however I'm not sure if it's done correctly. Perhaps there are concurrency issues I didn't think of? Please take a look at the scrip...

Make dependency generation using shell and %?

I have a bunch of directories. I want to build an object for each directory. Suppose OBJS contains "build/dir1 build/dir2 build/dir3", and the pattern I'm matching is build/%: % <do something here> I'd like to add, for each object, dependencies for every file within that directory (recursively). I thought of doing something like ...

Are there unix shell tools to compute various word statistics on files?

Not the base ones (like wc)... I need tools to build tag clouds, to compute semantic distance between files, to extract word-dictionary from a file, etc. ...

How to run every script in a directory except itself?

I have a folder full of *.command files on my OS X workstation. (For those that don't know, *.command files are just shell scripts that launch and run in a dedicated Terminal window). I've dragged this folder onto my Dock to use a "stack" so I can access and launch these scripts conveniently via a couple clicks. I want to add a new ...

Access Running Instance Of Application

Hi, I found there are lots of posts showing how to detect if the application instance already running. But I cant find any one that shows how to access or use the same running application. I have created shell menu items and linked them an application. For ex. If you right click on any folder it shows "OS Monitor". If i clicked on that...

Can you write a simple weekly reminder using a (ba)?sh script quine?

I need to set myself a reminder to attend a weekly meeting. The trouble with my company's standard reminder tool is that when it runs under wine, it pops up on an off-screen virtual desktop. I thought it would be interesting to see if I could come up with an "at" command that pops up a reminder window and then resubmits itself for the ...

Linux shell to restrict sftp users to their home directories?

Hiya, I need to give SFTP access to a directory within my webroot on my server. I've set up ben_files as a user and have set his home directory to /var/www/vhosts/mydomain.com/files That's all fine if he connects with plain old FTP - he's restricted just to that directory, but to enable SFTP i had to add him to bin/bash shell, which...

Shell execute from Ruby

Assume, I have a file 'text_file.txt' within my .rb script. How do I execute a default windows program for that file from the Ruby? ...

Problem with regular expression using grep

I've got some textfiles that hold names, phone numbers and region codes. One combination per line. The syntax is always "Name Region_code number" With any number of spaces between the 3 variables. What I want to do is search for specific region codes, like 23 or 493, forexample. The problem is that these numbers might appear in the lon...

Can't read variable that was stored from within a while loop, when out of the while loop.

I can't for the life of me see why I can not read the postPrioity outside the while loop. I tried "export postPrioity="500"" still didn't work. Any ideas? -- or in plan text -- #!/bin/bash cat "/files.txt" | while read namesInFile; do postPrioity="500" #This one shows the "$postPrioity" varible, as '500' echo "weeeeeeeeee --...

Monitor folder for new files using unix ksh shell script or perl script and trigger perl script

I've been Googling and Overflowing for a bit and couldn't find anything usable. I need a script that monitors a public folder and triggers on new file creation and then moves the files to a private location. I have a samba shared folder /exam/ple/ on unix mapped to X:\ on windows. On certain actions, txt files are written to the share...

Invoking sql statements in shell scripts

Hello members, I'm working on the Solaris environment and the DB i'm using is Oracle 10g. Skeleton of what I'm attempting; Write a ksh script to perform the following. I have no idea how to include my sql query within a shell script and loop through the statements. Have therefore given a jist of what I'm attempting, below. Copy file...

Selecting text in terminal without using the mouse

If I'm working in a terminal window in Linux, is there a keyboard shortcut I can use to select output displayed on previous lines? If I select something with the mouse I can copy using ctrl-shift-c, but is there a way to select without using the mouse at all. I'm using either gnome terminal or kde konsole in ubuntu desktop. For examp...

Add an entry to recycle bin right click menu using C#

I'm looking for a C# code to add my own entry to recycle bin right click menu. I've already seen this. What should i do to represent recycle bin.(Sample is provided for jpeg files) ...

Folder right click menu(Only Folder)

See this.What should i use instead of "Jpegfile" in the sample to represent folders? I don't want Drives,Recyclebin,Computer(My computer in XP),My Documents(in xp),etc. to be included too. I want my right click menu entry to be added to folders' right click menu only. Thanks and Regards. Please note: I can't use "Folder" since it include...

Bash: limit the number of concurrent jobs?

Is there an easy way to limit the number of concurrent jobs in bash? By that I mean making the & block when there are more then n concurrent jobs running in the background. I know I can implement this with ps | grep -style tricks, but is there an easier way? ...

Using sed to dynamically generate a file name

I have a CSV file that I'd like to split up based on a field in the file. Essentially, there can be two brands, GVA and HBVL. I'd like to split the file into a file for each brand before I import it into a database. Sample of the CSV file "D509379D5055821451C3695A3752DCCD",'1900-01-01 01:00:00',"M","1740","GVA",'2009-07-01 13:25:00',0 ...

How to force bash autocomplete to one command ?

Hello guys, I just upgrade to Ubuntu Karmic 9.10 and there is now emphaty. The problem is that em-TAB- doesn't autocomplete to emacs anymore ... I there a way to the my Bourne-Shell to complete em-TAB- always to emacs ? Thank you ...