bash

Cygwin BASH and ANSI control sequences

Several things here: Can anyone point me at C code to decode ANSI console escape sequences? Is there a way to get Cygwin BASH to emulate a dumb old TTY? Maybe this should be 2 questions. Thanks. ...

Determining working directory of another program.

Is there any way of determining the current working directory of an already running program in Linux? What I'm trying to achieve is I want to be able to work in a terminal and then have a keyboard shortcut set up which will run a tool which I am writing which displays a little popup window containing some information and a few buttons t...

How to check in a bash script if something is running and exit if it is.

I have a script that runs every 15 minutes but sometimes if the box is busy it hangs and the next process will start before the first one is finished creating a snowball effect. How can I add a couple lines to the bash script to check to see if something is running first before starting? ...

Mixing Single and Double Quotations in Bash

Alright, I have a script that takes a few arguments, runs data, and then rsyncs the data out to a different server. The problem is that to run the data, I have to take one of the arguments and then run a report using it, which is very bash unfriendly (Ex. [3023.2<>1], [5111.3$]="5", etc). So if I'm going to run the command, I need t...

How do I jump to the first line of shell output? (shell equivalent of emacs comint-show-output)

I recently discovered 'comint-show-output' in emacs shell mode, which jumps to the first line of shell output, which I find incredibly handy when looking at shell output that exceeds a screen length. The advantages of this command over scrolling with 'page up' are A) you don't have to scan with your eyes for the first line of the output...

How to do GUI for bash scripts?

I want to do some graphic dialogs for my script but don't know how. I hear something about GTK-Server or something like that. If someone know how to link bash with tcl/tk I also be satisfied. Please do not post something like "change to C++" because my project must be a script in BASH, there are no other option. Any ideas? P.S. Sorry ...

Is there a command-line shortcut for ">/dev/null 2>&1"

it's really annoying to type this whenever I don't want to see a program's output. I'd love to know if there is a shorter way to write: $ program >/dev/null 2>&1 Generic shell is the best, but other shells would be interesting to know about too, especially bash or dash. ...

Run a script at unlock?

Hey, I'd like to get a shell script to run everytime I unlock my computer, on KDE 4. I learned that I could run one by overwriting /usr/lib/kde4/libexec/krunner_lock with a shell script doing its thing, then the original krunner_lock binary, and I'd basically want to do the opposite: launch a script that "undoes" what the locking script ...

How to test a internet connection in bash?

How to test an internet connection without pinging to some website? I mean what if there are connection, but site is down, how to check that there is connection with world? ...

Warcraft III + wine + automatic battle.net logon

I need a little bash script which will send keyboard strokes to current running application under linux. This application runs under wine in Xorg. I'm trying to create script to automatically log me into battle.net account in Warcraft 3 game. ...

A better Linux shell?

I use bash, and have done so for over a decade - but occasionally I wonder whether there has been any significant new developments in the world of Linux shells. A few years back Microsoft released PowerShell, which seemed very interesting. Is there any comparable innovation going on in Linux shells? ...

how to make a PHP process auto-restart when dead?

Something like a daemon that will never die, my system is fedora10 ...

Bash Customizations

While I use Linux, I have not yet customized my bash shell, which I use a fair amount. So, I ask: What are your favorite customizations you have for bash? ...

OS X Keychain's Password Assistant feature via Terminal

OS X's Keychain has a Password Assistant feature that suggest passwords based on user criteria (e.g. Length = 18 and FIPS-181 compliant). I want to access this feature via bash. My specific interest is requesting generation of a password with my desired length and complexity attributes, then adding that password item to a specific keyc...

Is there a way to use Cygwin to run shell scripts and use proper path seperators for java commands

I'm trying to use Cygwin to test startup scripts for a Java application that is going to run in a Linux environment. The troule is when I specify a boothclasspath or Classpath I need to use OS specific path seperators ";" for windows, and ":" for Linux. This happens because Java is still a native windows application and uses the native ...

How do you send the output of ls to mv?

I know you can do it with a find, but is there a way to send the output of ls to mv in the unix command line? ...

bash: How to delimit strings to find files

What syntax should I use in a bash script to list files based on 3 dynamic values: - older than X days - in a specified directory - whose name contains a specified string? FILEAGE=7 FILEDIR='"/home/ecom/tmp"' FILESTRING='"search-results-*"' FILES_FOR_REMOVAL=$("/usr/bin/find "${FILEDIR}" -maxdepth 1 -type f -mtime +${FILEAGE} -name "${F...

How can I program ksh93 to use bash autocompletion?

In a comment in response to a shell question, user tinkertim said that it was easy to hack ksh to use the bash autocompletion library. I would like nothing better than to use bash autocompletion with AT&T ksh93. How can this be done? ksh93 has a new release several times a year, so I am looking for a solution that does not involve mod...

how to investigate ports opened by a certain process in linux?

Suppose the PID of the process is already known ...

Exicution of a OS command from a Python daemon

I've got a daemon.py with a callback. How should I make the handler function execute a OS command? ...