shell

gzip: stdout: File too large when running customized backup script

I've create a plain and siple backup script that only backs up certain files and folders. tar -zcf $DIRECTORY/var.www.tar.gz /var/www tar -zcf $DIRECTORY/development.tar.gz /development tar -zcf $DIRECTORY/home.tar.gz /home Now this script runs for about 30mins then gives me the following error gzip: stdout: File too large Any othe...

Assigning keyboard shortcut to get path of selected item in windows explorer

I don't know if this is even possible, but how can I bind some key combination to a (C#)program, so that when that keyboard shortcut is pressed with some file selected in windows explorer, it calls specific function with path of that file as a parameter. Or can I assign some keyboard shortcut so that windows explorer opens selected fil...

Reading into directory, unix shell script

I am trying to analyze the files/directories inside of a directory using a shell script, for example if the file is readable, if it is a file, if it is a directory, etc. My script is set up to take a directory as input. so I would type 'file.sh directoryname'. However, when I create a for loop to analyze the files, it analyzes the files ...

Is it possible to write a shell script which is faster to the same script in Perl?

I wrote multiple scripts in Perl and shell and I have compared the real execution time. In all the cases, the Perl script was more than 10 times faster than the shell script. So I wondered if it possible to write a shell script which is faster to the same script in Perl? And why is Perl faster than shell although I use the system functi...

Is there a way to find the running time of the last executed command in the shell?

Is there a command like time that can display the running time details of the last or past executed commands on the shell? ...

Emacs and Long Shell Commands

Is there a way to run a shell command, have the output show up in a new buffer and have that output show up incrementally? Eshell and other emacs terminal emulators do a find job of this but I see no way to script them. What I'd like to do is write little elisp functions to do stuff like run unit tests, etc. and watch the output trickle...

libclntsh.so.11.1: cannot open shared object file.

I want to schedule a task on linux by icrontab, and the task is written in python and have to import cx_Oracle module, so I export ORACLE_HOME and LD_LIBRARY_PATH in .bash_profile, but it raise the error: libclntsh.so.11.1: cannot open shared object file. Since it is ok to run the task by issue the command in shell like python a.p...

Can a shell loop unzip all the files in a directory?

I've seen loops to unzip all zip files in a directory. However, before I run this, I would rather make sure what I'm about to run will work right: for i in dir; do cd $i; unzip '*.zip'; rm -rf *.zip; cd ..; done Basically I want it to look at the output of "dir" see all the folders, for each directory cd into it, unzip all the zip arc...

Data in linux FIFO seems lost

Hi, I have a bash script which wants to do some work in parallel, I did this by putting each job in an subshell which is run in the background. While the number of jobs running simultaneously should under some limit, I achieve this by first put some lines in a FIFO, then just before forking the subshell, the parent script is required to...

How can I extract and save values from an XML file in Perl?

Here is what I am trying to do in a Perl script: $data=""; sub loadXMLConfig() { $filename="somexml.xml" $data = $xml->XMLin($filename); } sub GetVariable() { ($FriendlyName) = @_; switch($FriendlyName) { case "My Friendly Name" {print $data->{my_xml_tag_name}} .... .... ......

popen fails with "sh: <command>: not found"

I'm developing a server application and I recently encountered this wierd error on a testing server (Debian Squeeze). Every executable I pass to popen fails with a msg: sh: sort: not found // happens to any command This happens regardless whether I point to the full path returned by "type" or keep it short . As mentioned earlier, thi...

Textmate is garbling Rails test output

Instead of colors I see this.. Anyone know what might be causing this? ...

making a shell 'source' file use relative paths

I have the file: myvars MONO_PREFIX=/opt/mono export MONO_PATH=$MONO_PREFIX/lib/mono/2.0 I "use" it, by calling: source myvars I want to change /opt/mono to be relative to the location of the myvars file instead of being absolute. How could I do this? ...

Cross-platform getopt for a shell script

I've just found out that getopt is not cross-platform (in particular for FreeBSD and Linux). What is the best workaround for this issue? ...

finding the missing values in a range using any scripting language - perl, python or shell script

I got stuck in one problem of finding the missing values in a range and the range is also variable for the successive rows. input 673 673 673 676 676 680 2667 2667 2668 2670 2671 2674 output should be like this 674 675 677 678 679 2669 2672 2673 This is just one part and the row values can be more also If you need any clarification,...

Shell script not picking up password file...

Running the below shell script seems to ignore the password file I'm feeding it. I'm continually prompted for it. If I enter it, the rest of the script goes without a hitch, but as I'm running it via cron, I really need to get it to read from the file... Any suggestions? #!/bin/sh p=$(<password.txt) set -- $p pass_phrase=$1 destinatio...

echo that shell-escapes arguments

Is there a command that not just echos it's argument but also escapes them if needed (e.g. if a argument contains white space or a special character)? I'd need it in some shell magic where instead of executing a command in one script I echo the command. This output gets piped to a python script that finally executes the commands in a mo...

Is It possible to set environment variable and echo it in a single line batch script?

set A=2 && echo %A% This does not echo A as 2 in windows. Is there any way to do it? A=2 ; echo $A works in bash. I want a similar behavior on windows ...

Command passed as argument to shell script

Hi, I want to pass a command to a shell script. This command is a grep command. While executing I am getting the following errors, please help: myscript.sh "egrep 'ERROR|FATAL' \*20100428\*.log | grep -v aString" myscript.sh is a simple script: #!/bin/ksh cd log $1 the errors are: egrep: can't open | egrep: can't open grep egre...

In a process using lots of memory, how can I spawn a shell without a memory-hungry fork()?

On an embedded platform (with no swap partition), I have an application whose main process occupies most of the available physical memory. The problem is that I want to launch an external shell script from my application, but using fork() requires that there be enough memory for 2x my original process before the child process (which wil...