shell

Opera calling scripts with PSN on OSX

So I want to associate a particular 'protocol' in my Opera browser with a shell script on OSX. In Opera, I therefore did: <open preferences dialog> Advanced Tab -> Programs Added 'myProtocol' and set it to open with other application '~/bin/myScript.sh' Applied settings etc. Now, when I go to myProtocol://some.url.or.other, opera is...

On Linux, how do I recursively copy files while ignoring certain names?

I need to recursively copy a directory tree, ignoring any subdirectories named 'CVS'. Is there a simple way to do this? ...

How to accept command-line args ending in backslash

Here's a barebones Python app that simply prints the command-line arguments passed in: import sys if __name__ == "__main__": print "Arguments:" for i in range(len(sys.argv)): print "[%s] = %s" % (i, sys.argv[i]) And here's some sample runs: python args.py hello world Arguments: [0] = args.py [1] = hello [2] = world p...

Make windows batch file not close upon program exit

It's all in the title. When the program is over, I want it to say "Press any key to continue..." so I can scroll thru the output. ...

Batch files - number of command line arguments

Just converting some shell scripts into batch files and there is one thing I can't seem to find...and that is a simple count of the number of command line arguments. eg. if you have: myapp foo bar In Shell: $# -> 2 $* -> foo bar $0 -> myapp $1 -> foo $2 -> bar In batch ?? -> 2 <---- what command?! %* -> foo bar %0 -> myapp %1...

Iterating over options and quoted/unquoted arguments passed to bash script

I have a bash script that uses getopt to parse its parameters. It correctly handles switches and long options, as well as arguments and quoted arguments, but I cannot figure out how to iterate over the options/arguments string returned by the backticks. Something like: params=`getopt -o ab -l ccc -- "$@"` echo $params for param in "$pa...

BHO or Command Button for explorer

Hi I am trying to develop a command button that would appear on windows explorer. I can do this for an NSE but what I want to do is make the button visible on every explorer window. I want it to work for windows 7 and vista. I know it is possible as I have seen office Groove do it, and I am not sure if I have to implement the IExplorer(...

What does <() do in Bash?

In a post's answer on superuser.com, we see that join <(sort abc) <(sort bcd) will sort files abc and bcd before sending them to join. This leads to a programming question, better suited for stackoverflow. How does this work? What exactly is this <() construct? What's it called? If (sort abc) is a legal call that runs sort on abc ...

Drag and Drop to taskbar notification area with WinApi

Is it possible to implement drag and drop behavior in the notification area of the windows taskbar? Like having the icon there that can monitor something dragged and dropped on it. I suppose it should be a little bit tricky (if ever possible) ...

error executing shell script in PHP

I am trying to execute a shell command via: <php echo shell_execute("tac /home/kusmuk/access-logs/kusmuk.org"); ?> But it does not give any output. What could be the reason? Although it does not work, the following lines work as expected: <php echo shell_execute("ls -al triogrup.com"); ?> //outputs: -rw-r----- 2 root kusmuk 28640 Au...

Python IDE on Linux Console

This may sound strange, but I need a better way to build python scripts than opening a file with nano/vi, change something, quit the editor, and type in python script.py, over and over again. I need to build the script on a webserver without any gui. Any ideas how can I improve my workflow? ...

Why is Standard Input is not displayed as I type in Mac OS X Terminal application?

I'm confused by some behavior of my Mac OS X Terminal and my Django manage.py shell and pdb. When I start a new terminal, the Standard Input is displayed as I type. However, if there is an error, suddenly Standard Input does not appear on the screen. This error continues until I shut down that terminal window. The Input is still being ...

Cloning permissions of a folder to another folder

Are there any ways in OS X to clone the permissions of one folder to another. Just to be clear, I don't want to copy the entire folder, just the permissions and then set them on another folder. I think this type of thing could be achieved on Linux/UNIX using the setfacl/getfacl commands, but I'm unsure on how to do this with OS X. Thank...

How do I check for the existence of a file using a wildcard in Bourne shell?

What I'm looking for is something like: if [ -f "filenam*" ]; then ... fi But the wildcard (*) causes problems. I've also tried: if [ `ls filenam* > /dev/null 2>&1` ]; then ... fi Which may work in other shells but doesn't appear to work in Bourne shell (sh). Thanks for any help! EDIT: Sorry, not C shell, Bourne shell (s...

Shellwords.shellescape implementation for Ruby 1.8

While the build of 1.8.7 I have seems to have a backported version of Shellwords::shellescape, I know that method is a 1.9 feature and definitely isn't supported in earlier versions of 1.8. Does anyone know where I can find, either in Gem form or just as a snippet, a robust standalone implementation of Bourne-shell command escaping for ...

managed application crashes if is default shell in windows enbedded standard

Hi I changed explorer for a custom managed application in a windows embedded standard , but it crashes , it runs ok if i start it after running explorer as a shell but fails if it is the default shell. any ideas? thanks ...

How to embed bash script directly inside a git alias

Can I embed the following bash shell code: for name in $(git diff --name-only $1); do git difftool $1 $name & done directly into the creation of a git alias: git config --global alias.diffall ***my-bash-code-here*** This leads on from my previous question/answer on SO, where I put the code into a .sh file and then aliased to the f...

Bash Scripting - How to set the group that new files will be created with?

I'm doing a bash shell script and I want to change the default group that new files are created as. I know you use umask to change the permissions. Is there something for the group? ...

Ensuring the existence of a user on a Debian GNU/Linux system

I'm currently working on a Debian package for an in-house program. As part of this package, I need to create the user which most of the functionality of the program runs as. I am doing this in the postinst script. The postinst script can be run several times (on upgrade, for example), so it's important to ensure that I'm not going to ...

Windows Shell Context Menu option

I need to create an option for all files that would run a batch file located in Windows directory or any other directory. The batch file will basically delete the files and will also delete it from another server. I have the batch file wworking just need the context menu option. Thanks. ...